有人知道如何在这个jquerydiv
滑块中添加数字控件,我在这里设置小提琴
任何建议和想法表示赞赏。先感谢您......
var totalSlides = 0;
var currentSlide = 1;
var contentSlides = "";
$(document).ready(function(){
$("#slideshow-previous").click(showPreviousSlide);
$("#slideshow-next").click(showNextSlide);
var totalWidth = 0;
contentSlides = $(".slideshow-content");
contentSlides.each(function(i){
totalWidth += this.clientWidth;
totalSlides++;
});
$("#slideshow-holder").width(totalWidth);
$("#slideshow-scroller").attr({scrollLeft: 0});
updateButtons();
});
function showPreviousSlide()
{
currentSlide--;
updateContentHolder();
updateButtons();
}
function showNextSlide()
{
currentSlide++;
updateContentHolder();
updateButtons();
}
function updateContentHolder()
{
var scrollAmount = 0;
contentSlides.each(function(i){
if(currentSlide - 1 > i) {
scrollAmount += this.clientWidth;
}
});
$("#slideshow-scroller").animate({scrollLeft: scrollAmount}, 1000);
}
function updateButtons()
{
if(currentSlide < totalSlides) {
$("#slideshow-next").show();
} else {
$("#slideshow-next").hide();
}
if(currentSlide > 1) {
$("#slideshow-previous").show();
} else {
$("#slideshow-previous").hide();
}
}