superslide的defaultIndex属性


进入页面通过defaultIndex属性重新初始化轮播插件
$(function () { var index=0 var str = location.href; var agrs=str.indexOf('#')!=-1?str.split('#')[1]:str.split('_')[1] console.log(agrs) if(agrs){ $(".type-nav a").each(function (i) { var item = $(this).attr("href") if (item == '#'+agrs) { $(this).closest("li").addClass("cur").siblings().removeClass('cur'); if ($(item).offset()) { $("html,body").animate({ scrollTop: $(item).offset().top - 280 }, 200) } index=i-11 } }); } // 导航 $(".type-nav").slide({ titCell: ".hd ul", mainCell: ".bd ul", autoPage: true, effect: "left", autoPlay: false, vis: 10, pnLoop: false, defaultIndex:index }) });
原文地址:https://www.cnblogs.com/wszxx/p/10606025.html