[英]I am having trouble with my vegas slideshow in javascript
I have installed the vegas jquery plugin to my project with npm. 我已经使用npm将vegas jquery插件安装到我的项目中。 Now when I try to use it by following the documentation it does not seem to work.
现在,当我按照文档尝试使用它时,它似乎不起作用。 I have linked the vegas.min.js and vegas.min.css files in my html.
我已经在html中链接了vegas.min.js和vegas.min.css文件。
So, I have tried changing the path to the images, css, js files. 因此,我尝试更改图像,css,js文件的路径。 Since I thought it had something to do with the path to the image.
自从我认为这与图像的路径有关。
HTML: HTML:
<div class="container" id="slide">
<p class="invisible"></p>
</div>
JS: JS:
$(document).ready(function() {
let imagecollection = [
{src: './img/slide_0.jpg'},
{src: './img/slide_1.jpg'},
{src: './img/slide_2.jpg'},
];
$("#slide").vegas({
slides: imagecollection,
transition: 'fade',
preloadImage: true,
timer: true,
shuffle: true,
delay: 5000,
animation: 'kenburns',
cover: true
});
});
Now, I was hoping it would show the images every 5 seconds and go through the images, but this is not happening. 现在,我希望它能每5秒显示一次图像并浏览图像,但这没有发生。 I am not getting any errors in the console.
我在控制台中没有任何错误。
Found a solution 找到了解决方案
I made a rookie mistake by linking the JS files before calling the jQuery library. 在调用jQuery库之前,我通过链接JS文件犯了一个菜鸟错误。 Putting the js files after linking the jQuery fixed the issue!
链接jQuery后放置js文件可解决此问题!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.