gpt4 book ai didi

javascript - jquery 灯 slider 不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 09:40:12 27 4
gpt4 key购买 nike

我正在使用 lightSlider,我想在同一页面的其他地方使用另一个。我在这里使用这个 slider 形式 http://sachinchoolur.github.io/lightslider/我为第二个 lightSlider 编写了以下代码:

HTML:

<ul id="#lightSlider2">
<li>
<h5>NatGeo Live Student Mattenes</h5>
<img src="images/Layer-10.png" alt="">
</li>
<li>
<h5>NatGeo Live Student Mattenes</h5>
<img src="images/Layer-10.png" alt="">
</li>
<li>
<h5>NatGeo Live Student Mattenes</h5>
<img src="images/Layer-10.png" alt="">
</li>
<li>
<h5>NatGeo Live Student Mattenes</h5>
<img src="images/Layer-10.png" alt="">
</li>
</ul>

JS:

var slider2 = $("#lightSlider2").lightSlider({
item: 2,
autoWidth: false,
slideMove: 1, // slidemove will be 1 if loop is true
slideMargin: 10,
cssEasing: 'ease', //'cubic-bezier(0.25, 0, 0.25, 1)',//
easing: 'linear',
speed: 1000, //ms'
pause: 4000,
auto: true,
loop: true,
pauseOnHover: true,
controls: false,
pager: false,
enableDrag: false

});

CSS来自lightSlider css文件。但是第二个 slider 不起作用。

最佳答案

$(document).ready(function() {
$("#lightSlider ,#lightSlider2 ").lightSlider({
item: 3,
autoWidth: false,
slideMove: 1, // slidemove will be 1 if loop is true
slideMargin: 10,

addClass: '',
mode: "slide",
useCSS: true,
cssEasing: 'ease', //'cubic-bezier(0.25, 0, 0.25, 1)',//
easing: 'linear', //'for jquery animation',////

speed: 400, //ms'
auto: false,
loop: false,
slideEndAnimation: true,
pause: 2000,

keyPress: false,
controls: true,
prevHtml: '',
nextHtml: '',

rtl:false,
adaptiveHeight:false,

vertical:false,
verticalHeight:500,
vThumbWidth:100,

thumbItem:10,
pager: true,
gallery: false,
galleryMargin: 5,
thumbMargin: 5,
currentPagerPosition: 'middle',

enableTouch:true,
enableDrag:true,
freeMove:true,
swipeThreshold: 40,

responsive : [],

onBeforeStart: function (el) {},
onSliderLoad: function (el) {},
onBeforeSlide: function (el) {},
onAfterSlide: function (el) {},
onBeforeNextSlide: function (el) {},
onBeforePrevSlide: function (el) {}
});

});
<link href="https://cdnjs.cloudflare.com/ajax/libs/lightslider/1.1.5/css/lightslider.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightslider/1.1.5/js/lightslider.min.js"></script>
<ul id="lightSlider">
<li>
<h3>First Slide</h3>
<p>Lorem ipsum Cupidatat quis pariatur anim.</p>
</li>
<li>
<h3>Second Slide</h3>
<p>Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.</p>
</li>
<li>
<h3>third Slide</h3>
<p>Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.</p>
</li>
<li>
<h3>forth Slide</h3>
<p>Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.</p>
</li>
</ul>

<ul id="lightSlider2">
<li>
<h3>First Slide</h3>
<p>Lorem ipsum Cupidatat quis pariatur anim.</p>
</li>
<li>
<h3>Second Slide</h3>
<p>Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.</p>
</li>
<li>
<h3>third Slide</h3>
<p>Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.</p>
</li>
<li>
<h3>forth Slide</h3>
<p>Lorem ipsum Excepteur amet adipisicing fugiat velit nisi.</p>
</li>
</ul>

关于javascript - jquery 灯 slider 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39995673/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com