bxslider calculating wrong viewport size on load

前端 未结 6 1437
醉梦人生
醉梦人生 2021-02-07 05:06

Anyway I recently started using bxslider and I\'m having an issue with it.

It seems to calculate its viewport size wrongly on page load, which means it doesn\'t work we

6条回答
  •  有刺的猬
    2021-02-07 05:51

    Matthew Watson gave me a good idea and I went into the plugin and updated the actual getViewPortHeight() function like so :

    var getViewportHeight = function(){
        var height = 0;
        children = slider.children;
        height = jQuery(slider.children[0]).height();;
        return height;
    }
    

    So now it is taking the height of the first image in there (hopefully they are all the same…) and using that to determine the height of the slider. Please note, your controls will still sit below the slider, but this can be fixed with css positioning etc.

    Hope this helps some lost folks out there.

提交回复
热议问题