Javascript Jquery滑块更改
我很难改变滑块的行为: 以下是html:Javascript Jquery滑块更改,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我很难改变滑块的行为: 以下是html: <div class="media"> <div class="slideButtons"> <span class="prev"><</span> <span class="next">/ ></span> </div> <ul class="gallery" id="olympGall
<div class="media">
<div class="slideButtons">
<span class="prev"><</span>
<span class="next">/ ></span>
</div>
<ul class="gallery" id="olympGallery">
<li></li>
<li></li>
<li>.</li>
</ul>
</div>
以下是js:
<script>
var speed = 200;
$(".prev").click(function() {
var now = $(this).parent().next("ul.gallery").children(":visible"),
last = $(this).next("ul.gallery").children(":last"),
prev = now.prev();
prev = prev.index() == -1 ? last : prev;
now.fadeOut(speed, function() {prev.fadeIn(speed);});
});
$(".next").click(function() {
var now = $(this).parent().next("ul.gallery").children(':visible'),
first = $(this).parent().next("ul.gallery").children(':first'),
next = now.next();
next = next.index() == -1 ? first : next;
now.fadeOut(speed, function() {next.fadeIn(speed);});
});
$(".gallery li").click(function() {
var first = $(this).parent().children(':first'),
next = $(this).parent().next();
next = next.index() == -1 ? first : next;
$(this).fadeOut(speed, function() {next.fadeIn(speed);});
});
</script>
无功转速=200;
$(“.prev”)。单击(函数(){
var now=$(this.parent().next(“ul.gallery”).children(“:visible”),
last=$(this.next(“ul.gallery”).children(“:last”),
prev=now.prev();
prev=prev.index()=-1?最后一个:prev;
now.fadeOut(速度,函数(){prev.fadeIn(速度);});
});
$(“.next”)。单击(函数(){
var now=$(this.parent().next(“ul.gallery”).children(“:visible”),
first=$(this.parent().next(“ul.gallery”).children(“:first”),
next=now.next();
next=next.index()=-1?first:next;
now.fadeOut(速度,函数(){next.fadeIn(速度);});
});
$(“.gallery li”)。单击(函数(){
var first=$(this.parent().children(“:first”),
next=$(this.parent().next();
next=next.index()=-1?first:next;
$(this.fadeOut(速度,函数(){next.fadeIn(速度);});
});
所以问题是,当我尝试重新定位控件时,下面的控件会终止脚本,不会在单击时滑动。另一个问题是,如果我单击左侧导航,它也会终止脚本,但前提是在页面加载后单击幻灯片1
所以我需要在不破坏脚本的情况下将控件移动到容器的任一侧-添加自动滑动功能,并修复小错误-有什么想法吗
我尝试过浮动控件-我尝试过使用控件查找自动滚动,但除了正常状态外,无法使这个简单的滑块工作…欢迎使用堆栈溢出。请避免发布重复的问题。如果您想改进或修改您的问题,请使用“编辑”选项。非常抱歉-我认为我在上一篇文章中没有正确解释自己,也不知道如何修改-但我刚刚看到了“编辑”链接…非常抱歉。@TilwinJoy您有什么想法吗?