简体   繁体   English

用JavaScript突出显示Blogger Blogspot中的活动菜单项

[英]Highlighting active menu item in blogger blogspot with javascript

I've got an issue with this javascript that I use to highlight active items in a navigation tab. 我遇到了一个与此JavaScript有关的问题,该问题用于突出显示导航标签中的活动项目。 Everything's working fine here http://jsfiddle.net/gfkM4/148/ but in blogger it is not: 一切正常,在这里http://jsfiddle.net/gfkM4/148/,但在Blogger中却不是:

I added the class 我加了课

.active_item {
    background:#EFEFEF;
}

to my template and put this script in front of the closing header tag 到我的模板,然后将此脚本放在结束标头标签的前面

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type='text/javascript'>

/* Function to add class active_item to navsub */

(function () {
    $('.navsub li').bind('click', function (e) {
        var el = $(this),
            list = $('.navsub').find('li');
        list.removeClass('active_item');
        el.addClass('active_item');
    });
}());

</script>

</head>

However, the class is not added as expected on blogger... Any hints are greatly appreciated! 但是,该类未按预期在Blogger上添加。非常感谢任何提示!

..问题不使用javascript就解决了-参见评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM