简体   繁体   English

预加载JS文件或最后加载图像

[英]Preload JS file or load images last

Hi I have a slider which uses bxslider as a plugin and the images load before the javascript therefore there is a moment before the JS file has loaded but before the images have where there is display issues. 嗨,我有一个滑块,它使用bxslider作为插件,并且在javascript之前加载了图像,因此有一段时间在加载JS文件之前但在图像具有显示问题之前。 How can I fix this? 我怎样才能解决这个问题?

http://orchid-goose.cloudvent.net/ http://orchid-goose.cloudvent.net/

put the implementation of the slider in 将滑块的实现放在

$(window).on("load", function() {
    // weave your magic here.
});

That function will be executed, when all data was loaded 加载所有数据后,将执行该功能

Set css property visibility:hidden for the slider and make it visible once the script has finished loading. 为滑块设置css属性visible visibility:hidden ,并在脚本加载完成后使其可见。 You can have a placeholder image as background in the parent container, eg a gif indicating it is loading. 您可以在父容器中将一个占位符图像作为背景,例如,表示正在加载的gif。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM