2012-04-18 4 views

답변

1

예. 당신은 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'); 

}); 
+0

돼 그래. 알았어요. 건배 남자. 고마워. – user1340101

+2

안녕 얘들 아, 그걸 위해 모범을 보일 수 있니? jsfidlle처럼. – IAMTHESTIG

관련 문제