1
A
回答
1
是的。您可以將hash history addin用於同位素,它使用jQuery BBQ。
本示例僅僅是Isotope文檔中哈希歷史記錄頁面源的副本。
$(window).bind('hashchange', function(event){
// get options object from hash
var hashOptions = window.location.hash ? $.deparam.fragment(window.location.hash, true) : {},
// do not animate first call
aniEngine = hashChanged ? 'best-available' : 'none',
// apply defaults where no option was specified
options = $.extend({}, defaultOptions, hashOptions, { animationEngine: aniEngine });
// apply options from hash
$container.isotope(options);
// save options
isotopeOptions = hashOptions;
// if option link was not clicked
// then we'll need to update selected links
if (!isOptionLinkClicked) {
// iterate over options
var hrefObj, hrefValue, $selectedLink;
for (var key in options) {
hrefObj = {};
hrefObj[ key ] = options[ key ];
// convert object into parameter string
// i.e. { filter: '.inner-transition' } -> 'filter=.inner-transition'
hrefValue = $.param(hrefObj);
// get matching link
$selectedLink = $optionSets.find('a[href="#' + hrefValue + '"]');
changeSelectedLink($selectedLink);
}
}
isOptionLinkClicked = false;
hashChanged = true;
})
// trigger hashchange to capture any hash data on init
.trigger('hashchange');
});
噢是的。已經排序。歡呼男人。感謝堆。 – user1340101 2012-04-29 21:56:02
大家好,你能舉個例子嗎?像jsfidlle一樣。 – IAMTHESTIG 2012-12-18 07:13:20