admin管理员组

文章数量:1392007

I have only one list div and I want to make it scrollable. I have seen scrollpane examples, it's great but I am looking for an smaller simpler alternative.

I appreciate any help.

Thanks.

I have only one list div and I want to make it scrollable. I have seen scrollpane examples, it's great but I am looking for an smaller simpler alternative.

I appreciate any help.

Thanks.

Share Improve this question asked Nov 19, 2010 at 15:18 Josh RJosh R 1,2956 gold badges19 silver badges31 bronze badges 4
  • have you already written some code to see? Are you trying to scroll an <ul> inside a shorter <div>? – fcalderan Commented Nov 19, 2010 at 15:24
  • Maybe try the smallest and simplest solution: css overflow: auto; bined with fixed height or width. – pawel Commented Nov 19, 2010 at 15:27
  • @fcalderan Yeah <ul> inside a <div> – Josh R Commented Nov 19, 2010 at 15:33
  • @pawel I also get a greyed out horizontal scroll which messes other elements on the page. – Josh R Commented Nov 19, 2010 at 15:44
Add a ment  | 

2 Answers 2

Reset to default 3

Don't think you need jquery, just add style="overflow:auto;" to the div.

For Future readers ...

If jQuery is must then you can do this by :

// Any one accordingly ...

$('#yourIdForDiv').attr('overflow','auto');
$('#yourIdForDiv').attr('overflowy','scroll');
$('#yourIdForDiv').attr('overflowx','auto');

本文标签: javascriptHow to make a div scrollable using jqueryStack Overflow