2010-08-14 28 views

回答

1

除了该网页上的代码(它仍然在document.ready后),你可以这样做:

$("#filtering-nav a[href='" + location.hash + "']").click(); 

当你去page.htm#red例如这只是执行对<a href="#red">点击。

或者,如果你希望他们立即隐藏,这样做:

var myClass = location.hash.replace('#','.'); 
$("#primary").children().not(myClass).addClass('invis').hide(); 
$('#primary').masonry(); 

这不需要过滤按钮,它只是隐藏任何东西在散列不匹配的类,像这样:page.htm#classToShow