1
프로젝트에 jQuery Isotope을 사용하고 있습니다.다른 페이지에서 필터 값을 전달할 수 있습니까?
다른 페이지의 href 링크에서 필터 값을 전달할 수 있습니까? 그래서 내가 동위 원소가있는 페이지에 착륙했을 때, href를 기반으로 레이아웃을 필터링합니다.
프로젝트에 jQuery Isotope을 사용하고 있습니다.다른 페이지에서 필터 값을 전달할 수 있습니까?
다른 페이지의 href 링크에서 필터 값을 전달할 수 있습니까? 그래서 내가 동위 원소가있는 페이지에 착륙했을 때, href를 기반으로 레이아웃을 필터링합니다.
예. 당신은 jQuery BBQ을 사용하는 동위 원소에 대해 hash history addin을 사용할 수 있습니다.
이 예는 단지 인 동위 원소 문서의 해시 기록 페이지의 소스에서 copypasta.
$(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
안녕 얘들 아, 그걸 위해 모범을 보일 수 있니? jsfidlle처럼. – IAMTHESTIG