Getting a div to be drag and scrollable with a jquery plugin

I am trying to use the jquery plugin found here (https://github.com/mvlandys/jquery.dragscrollable) to make a div scrollable, but I can’t seem to get it to work at all. I had success making it scroll horizontally by fiddling with things, but not vertically. I think I am overlooking some basic css thing such as making a container or its contents the right size, so this may be more of CSS question than a javascript one.

Here is a codepen: http://codepen.io/anon/pen/rLGPxg. The js I added is at the bottom. It’s pretty simple, just

$(document).ready(function() {
  $('.drag-this').dragscrollable();
 });

It can be dragged and scrolled horizontally but not vertically - try holding down your mouse over the text and moving to the right.

(The p is floated because all of the children elements in my real code are floated.)

What I want is for a specific div to expand to its full size, but not cause the browser to grow a scrollbar (at least by the div that should be draggable - other elements might cause a scrollbar) instead, the area of the div can be grabbed and scrolled, like google maps.

Any help appreciated!

You set the height of the container to auto, so there simply is nothing to drag-scroll vertically. Try setting it to a fixed number and it will work.

1 Like

It worked, thank you!

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.