bxslider calculating wrong viewport size on load

Error
bxslider calculate its viewport size wrongly on page load.
when resizing the window of the browser(even just for a pixel) the viewport height gets calculated correctly and everything looks fine. But on refreshing the page with same height and width bx-viewport calculation goes wrong.

Solution
It may because bxSlider function calls too early.

If you’re invoking it from

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

consider instead using

$(window).load(function() { ... });

The difference between using those two functions is that (document).ready waits until the DOM has been shown to the user in it’s initial state, whereas (window).load actually waits until all resources have been loaded onto the DOM.

Ref: http://stackoverflow.com/questions/13722282/bxslider-calculating-wrong-viewport-size-on-load

Leave a comment