如何让 jquery 根据我的 url 隐藏菜单选项?
How can I get jquery to hide menu options depending on my url?
在我的网站上,我实施了一个 jquery 代码,它根据 url:
关闭我的 CSS 菜单的类别
$(document).ready(function(){
$('.workopen').click(function(e){
$(this).siblings('.open').addBack().toggleClass('open');
e.stopPropagation();
});
if (window.location.href.indexOf("glorious.html") > -1) {
$('.work .workopen .four').siblings('.open').addBack().toggleClass('open')}
});
我想添加一点 JQuery 来改变 CSS,这样如果上面的索引是 "glorious.html"。这可能是一个非常简单的修复,但我对 JQuery 的了解有点有限:/ help?
$('.workopen').click(function(e){
$(this).siblings('.open').addBack().toggleClass('open');
e.stopPropagation();
});
if (window.location.href.indexOf("glorious.html") > -1) {
$('.work .workopen .four').siblings('.open').addBack().toggleClass('open')}
$('#div1').css("display","none"); //# is used for id and . is used for class
});
在我的网站上,我实施了一个 jquery 代码,它根据 url:
关闭我的 CSS 菜单的类别$(document).ready(function(){
$('.workopen').click(function(e){
$(this).siblings('.open').addBack().toggleClass('open');
e.stopPropagation();
});
if (window.location.href.indexOf("glorious.html") > -1) {
$('.work .workopen .four').siblings('.open').addBack().toggleClass('open')}
});
我想添加一点 JQuery 来改变 CSS,这样如果上面的索引是 "glorious.html"。这可能是一个非常简单的修复,但我对 JQuery 的了解有点有限:/ help?
$('.workopen').click(function(e){
$(this).siblings('.open').addBack().toggleClass('open');
e.stopPropagation();
});
if (window.location.href.indexOf("glorious.html") > -1) {
$('.work .workopen .four').siblings('.open').addBack().toggleClass('open')}
$('#div1').css("display","none"); //# is used for id and . is used for class
});