简体   繁体   English

我在javascript中使用拉斯维加斯幻灯片放映时遇到了麻烦

[英]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.

相关问题 我在 javascript 中遇到了回文函数的问题 - I am having trouble with a palindrome function in javascript 我的碰撞代码有问题 - I am having trouble with my collision code 我的 JavaScript 代码在尝试使用 keydown 事件处理程序更改类中的变量时遇到问题 - I am having trouble in my JavaScript code trying to change a variable in a class with a keydown event hander Vegas幻灯片插件-如何延迟幻灯片开始的时间? - Vegas Slideshow Plugin - How can I delay the moment the slideshow starts? 我使用Pixastic的HTML5 Canvas和Javascript过滤器处理图像时遇到问题,我在做什么错? - I am having trouble processing my image using HTML5 Canvas and Javascript Filters from Pixastic, what am I doing wrong? 我的JavaScript遇到问题 - Having trouble with my javascript Javascript:我在将随机字符串按字母顺序排序时遇到麻烦 - Javascript: I am having trouble ordering a random string into alphabetical order 我在将IF else语句与Javascript中的函数配对时遇到麻烦 - I am having trouble with pairing an IF else statement with a function in Javascript 我很难理解这个说法: - I am having trouble getting my head around this statement: 在我的 javascript 中解析 json 文件时遇到问题..但我得到“responseObject.weather[i].weatherresponseObject.weather[i].description” - Having trouble parsing json file in my javascript..but I am getting "responseObject.weather[i].weatherresponseObject.weather[i].description"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM