我如何使用jquery切换div关闭,如果URL http://www.mydomain.co.uk/index.php#something中存在#something,则隐藏下面的框(关闭它)
<div id="feature">content</div>
答案 0 :(得分:1)
$(function() {
if(window.location.hash.indexOf('something') !== -1) {
$('div#feature').hide();
}
});
答案 1 :(得分:0)
选中window.location.hash
。
if (window.location.hash == "something") $("#featured").hide();