Collapse toggle panel (div) which responds to anchor in url
For a FAQ i need a toggle pane开发者_如何转开发l similiar to this one:
http://roshanbh.com.np/examples/exapandable-panel/One specialty is that it always needs to open the box i request via an anchor in the url.
./faq.php#middle
should open the box in the middle and keep all the other boxes collapsed.
If no anchor is given in the url only the first box should be opened.
How to get this working?
$(document).ready(function(){
$('a[href^="#"]').click(function(){
var id = $(this).attr('href');
$(id).show();
});
if (location.hash) {
$(location.hash).show()
}
});
精彩评论