简体   繁体   中英

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. Everything's working fine here http://jsfiddle.net/gfkM4/148/ but in blogger it is not:

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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