Click & drag responsive map

Hey Guys, So I’m kinda losing it here… If you go to my live website and click the top-left navbar icon you can see an image on the right side which is draggable because of the code in the body, but I’m struggling to figure out how to prevent vertical dragging… Basically I only want to be able to drag the image horizontally.

Is anyone able to help me? Thanks in advance.

read only link

I’m bumping this thread, I would really appreciate some help.

Thanks,

Hello @TimSijtema,

Try adding the axis that you want to use, I think it would have to look something like this on your code:

$( ".draggable-image" ).draggable({
      axis: 'x',
      cursor : "grabbing",
      start  : function(event, ui) {
         $(this).css('cursor','grabbing');
     },
      stop  : function(event, ui) {
         $(this).css('cursor','grab');
     } 
 });

Thank you so much! It finally works :slight_smile:

1 Like