2014-03-24 49 views

回答

0

當然,改變你的href包括查詢字符串參數來表示幻燈片:

<a href="page2.html?slide=0">SLIDE 1</a> 
<a href="page2.html?slide=1">SLIDE 2</a> 

然後改變根據傳入的查詢參數的第2頁開始幻燈片:

$('#rotating-item-wrapper').cycle({ 
    startingSlide: (getParameterByName('slide') || 0); 
}); 

使用以下函數提取您的查詢字符串參數(found here):

function getParameterByName(name) { 
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); 
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), 
    results = regex.exec(location.search); 
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); 
}