0
我有循環生成anchorlinks,在幻燈片頁面內工作正常。但是,從其他頁面鏈接到它們並不完美。他們總是轉到組的第一張幻燈片,而不是由網址哈希定義的幻燈片。這裏是我的代碼:jQuery循環固定鏈接不工作,總是去第一張幻燈片
$(function() {
$('#cms').cycle({
fx: 'fade',
speed: 'fast',
pager: '#nav',
pagerAnchorBuilder: function(idx, slide) {
return '<li><a href="#' + slide.title + '">' + slide.title + '</a></li>';
},
timeout: 0,
after: function(curr,next,opts) {
window.location.hash = $(this).attr('title');
}
});
});
及相關HTML:
<div id="nav"></div>
<div id="cms">
<div title="About"><?php include 'about.php' ?></div>
<div title="Music"><?php include 'music.php' ?></div>
<div title="Shows"><?php include 'shows.php' ?></div>
</div>
基本上,如果我鏈接到(或者打開一個新的瀏覽器選項卡並輸入)的「http://路徑/要/我的/ page /#音樂「或#Shows,它只是去#About。
我知道我失去了一些東西,但我不知道什麼