var btn=sessionStorage.getItem("btn");
if(btn!=null || btn!=undefined){
$('.btn-icon').scrollLeft(btn);
}
function showPurInfo(id){
sessionStorage.setItem("btn",0);
window.location.href='${ctx}/public/sunshinePurchase/look?id='+id
}
function showNewInfo(id){
var kuaiWidth=parseInt($(".tab-click").css("width").substr(0,$('.tab-click').css("width").length-2))*1;
var divWidth=$('.btn-icon').css("width").substr(0,$('.btn-icon').css("width").length-2)
sessionStorage.setItem("btn",divWidth-kuaiWidth);
window.location.href='${ctx}/news/one/'+id
}
两个function是跳转其他页面的方法,运行方法的同事保存了btn值,btn的值就是要自动滑动的距离.当页面加载的时候会先从sessionStorage中获取btn的值,如果没有页面就是默认位置,如果我们点击过这两个跳转页面的方法,那么sessionStorage中就会有值,我们使用 (′.btn−ico