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中就會有值,我們使用