我的javascript非常基础,我正在寻找正确方向的推动
我刚刚制作了一个简单的滑块,单击时效果很好。但我现在被要求让它自动循环播放幻灯片。
你能建议我应该看什么样的功能吗?
我在 codepen 上放了我的代码的工作副本:http: //codepen.io/DeadWhisky/pen/kvytH
这是javascript:
$("#kickstart").click(function () {
document.getElementById("slider-ul").style.top="0px";
document.getElementById("slider-nav").style.background="url(http://dev.learningpeople.co.uk/imgs/entry-it/slider-nav.png) repeat-y 0 -201px";
});
$("#support").click(function () {
document.getElementById("slider-ul").style.top="-160px";
document.getElementById("slider-nav").style.background="url(http://dev.learningpeople.co.uk/imgs/entry-it/slider-nav.png) repeat-y 0 -161px";
});
$("#security").click(function () {
document.getElementById("slider-ul").style.top="-320px";
document.getElementById("slider-nav").style.background="url(http://dev.learningpeople.co.uk/imgs/entry-it/slider-nav.png) repeat-y 0 -121px";
});
$("#network").click(function () {
document.getElementById("slider-ul").style.top="-480px";
document.getElementById("slider-nav").style.background="url(http://dev.learningpeople.co.uk/imgs/entry-it/slider-nav.png) repeat-y 0 -81px";
});
$("#slider-nav li").click(function() {
$("#slider-nav li").removeClass("selected");
$(this).addClass("selected");
});