I want to put a big table inside a scrollable div, which is itself is inside a fieldset. Like here http://live.datatables.net/exejuy/2/edit The problem that it is only working correctly in IE. Chrome, Opera and Firefox all do not allow me to scroll Anyone knows why and how to fix it?

有帮助吗?

解决方案

You can use this type of jquery and Css code. and add it to your scroll div

<script type="text/javascript">
$(document).ready(function() {
 var bodyWidth = $(window).width();
 $('.scrolldiv').css('width',bodyWidth);
});
</script>

CSS

.scrolldiv{
    overflow:scroll;
}

You can see jsfiddle

If you want fluid view when resize u can also use this code

 $(document).ready(function() {
getwidth();
});

$(window).resize(function() {
getwidth();
});
function getwidth()
{
 var bodyWidth = $(window).width();
 $('.scrolldiv').css('width',bodyWidth);    
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top