I have enormous table to render on website. I need to make it scroll horizontally. Normally I would set fixed width
and overflow: scroll
but not in this case. The table is pretty tall so I don't see scroll at the bottom of web browser.
Demo: http://jsfiddle.net/cpmjng5b/1/embedded/result/
I could set fixed height
but I have text before table that height is dynamic.
http://jsfiddle.net/cpmjng5b/5/embedded/result/
What should I do? Try to calculate div.container
height in JS? I already tried floating scroll plugin for jQuery but it is relatively slow. Can I make it in pure css somehow?
This solution is using jquery, but you could also do it with javascript.
The height in the fiddle is a little off due to the jsfiddle "Result" header, but you can add/subtract any additional pixels if you have a top navigation.
var viewportHeight = $(window).height();
var topcontentHeight = $(".dynamicText").height();
$(".container").css("max-height", (viewportHeight - topcontentHeight) + 'px');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.