Toggle a div closed if a #something is present in a URL
How can i toggle a div closed using jquery ie hide the box below (close it) if #something is present in the URL http://www.mydomain.co.uk/index.php#some开发者_运维百科thing
<div id="feature">content</div>
$(function() {
if(window.location.hash.indexOf('something') !== -1) {
$('div#feature').hide();
}
});
By checking the window.location.hash
.
if (window.location.hash == "something") $("#featured").hide();
精彩评论