我建议从头开始编写自己的,尽管我在这里做了:
http://jsfiddle.net/Hive7/agG2b/
这是我使用的jquery:
$(document).ready(function () {
$(".slide_button_left").click(function () {
if ($("li.slideshow1").css("margin-left") === "-1010px") {
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_1").css("background", "red");
}
if ($("li.slideshow1").css("margin-left") === "-1515px") {
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_2").css("background", "red");
}
if ($("li.slideshow1").css("margin-left") === "-2020px") {
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_3").css("background", "red");
}
if ($("li.slideshow1").css("margin-left") === "-505px") {
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_4").css("background", "red");
}
if ($("li.slideshow1").css("margin-left") === "-1010px") {
$("li.slideshow1").animate({
'margin-left': "-505px"
}, 300);
}
if ($("li.slideshow1").css("margin-left") === "-1515px") {
$("li.slideshow1").animate({
'margin-left': "-1010px"
}, 300);
}
if ($("li.slideshow1").css("margin-left") === "-2020px") {
$("li.slideshow").css("margin-left")
$("li.slideshow1").animate({
'margin-left': "-1515px"
}, 300);
}
if ($("li.slideshow1").css("margin-left") === "-505px") {
$("li.slideshow1").animate({
'margin-left': "5px"
}, 300, function(){
$("li.slideshow1").stop().animate('margin-left', "5px");
if($("li.slideshow1").css("margin-left") === "5px"){
$("li.slideshow1").css("margin-left", "-2020px")
}
});
}
});
$(".slide_button_right").click(function () {
if ($("li.slideshow1").css("margin-left") === "-1010px") {
$("li.slideshow1").animate({
'margin-left': "-1515px"
}, 300);
if($("li.slideshow1").css("margin-left") === "-1010px"){
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_3").css("background", "red");
}
}
if ($("li.slideshow1").css("margin-left") === "-1515px") {
$("li.slideshow1").animate({
'margin-left': "-2020px"
}, 300);
if($("li.slideshow1").css("margin-left") === "-1515px"){
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_4").css("background", "red");
}
}
if ($("li.slideshow1").css("margin-left") === "-505px") {
$("li.slideshow1").animate({
'margin-left': "-1010px"
}, 300);
if($("li.slideshow1").css("margin-left") === "-505px"){
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_2").css("background", "red");
}
}
if ($("li.slideshow1").css("margin-left") === "-2020px") {
if($("li.slideshow1").css("margin-left") === "-2020px"){
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "red");
}
$("li.slideshow1").animate({
'margin-left': "-2520px"
}, 300, function(){
$("li.slideshow1").stop().animate('margin-left', "-2520px");
if($("li.slideshow1").css("margin-left") === "-2520px"){
$("li.slideshow1").css("margin-left", "-505px")
}
});
}
});
$("a.slidebutton_1").click(function () {
if ($("li.slideshow1").css("margin-left") === "-1010px") {
$("li.slideshow1").animate({
'margin-left': "-505px"
}, 300);
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_1").css("background", "red");
}
if ($("li.slideshow1").css("margin-left") === "-1515px") {
$("li.slideshow1").animate({
'margin-left': "-505px"
}, 380);
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_1").css("background", "red");
}
if ($("li.slideshow1").css("margin-left") === "-2020px") {
$("li.slideshow1").animate({
'margin-left': "-505px"
}, 460);
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_1").css("background", "red");
}
});
$("a.slidebutton_2").click(function () {
if ($("li.slideshow1").css("margin-left") === "-505px") {
$("li.slideshow1").animate({
'margin-left': "-1010px"
}, 300);
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_2").css("background", "red");
}
if ($("li.slideshow1").css("margin-left") === "-1515px") {
$("li.slideshow1").animate({
'margin-left': "-1010px"
}, 300);
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_2").css("background", "red");
}
if ($("li.slideshow1").css("margin-left") === "-2020px") {
$("li.slideshow1").animate({
'margin-left': "-1010px"
}, 380);
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_2").css("background", "red");
}
});
$("a.slidebutton_3").click(function () {
if ($("li.slideshow1").css("margin-left") === "-505px") {
$("li.slideshow1").animate({
'margin-left': "-1515px"
}, 380);
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_3").css("background", "red");
}
if ($("li.slideshow1").css("margin-left") === "-1010px") {
$("li.slideshow1").animate({
'margin-left': "-1515px"
}, 300);
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_3").css("background", "red");
}
if ($("li.slideshow1").css("margin-left") === "-2020px") {
$("li.slideshow1").animate({
'margin-left': "-1515px"
}, 300);
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_3").css("background", "red");
}
});
$("a.slidebutton_4").click(function () {
if ($("li.slideshow1").css("margin-left") === "-505px") {
$("li.slideshow1").animate({
'margin-left': "-2020px"
}, 460);
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_4").css("background", "red");
}
if ($("li.slideshow1").css("margin-left") === "-1010px") {
$("li.slideshow1").animate({
'margin-left': "-2020px"
}, 380);
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_4").css("background", "red");
}
if ($("li.slideshow1").css("margin-left") === "-1515px") {
$("li.slideshow1").animate({
'margin-left': "-2020px"
}, 300);
$("a#slide_buttons").css("background", "none");
$("a.slidebutton_1").css("background", "none");
$("a.slidebutton_4").css("background", "red");
}
});
$(".slide_button_right").mouseover(function () {
$("a.slide_button_right").css("background-color", "#000");
$("a.slide_button_right").css("background-size", "60px 54px");
$("a.slide_button_right").css("background-position", "-30px 0px");
});
$(".slide_button_right").mouseout(function () {
$("a.slide_button_right").css("background-color", "#fff");
$("a.slide_button_right").css("background-size", "60px 54px");
$("a.slide_button_right").css("background-position", "0px 0px");
});
$(".slide_button_left").mouseover(function () {
$("a.slide_button_left").css("background-color", "#000");
$("a.slide_button_left").css("background-size", "60px 54px");
$("a.slide_button_left").css("background-position", "-30px 0px");
});
$(".slide_button_left").mouseout(function () {
$("a.slide_button_left").css("background-color", "#fff");
$("a.slide_button_left").css("background-size", "60px 54px");
$("a.slide_button_left").css("background-position", "0px 0px");
});
});
添加这个:
<script>
if($('ul').css('left') === '300%') {
$('ul').animate({'left' : '0%'}, 5000)
}
</script>
要更改所需的时间,请将 5000 数字更改为您想要的