Created
June 30, 2013 03:40
-
-
Save Partoo/5893747 to your computer and use it in GitHub Desktop.
Some common code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Highlight current category | |
| $(function () { | |
| var url = window.location.pathname, | |
| re = /^\/\w*/; | |
| urlRegExp=url.match(re); | |
| urlRe = new RegExp(url.replace( /^\/\w*/)); | |
| $('ul.mainNav>li >a').each(function(){ | |
| if ($(this).attr('href').match(re).toString()==url.match(re).toString()) { | |
| $(this).parent("li").addClass('current'); | |
| } | |
| }); | |
| //Show banner random | |
| $('.mainNav li').hover(function () {$('ul', this).show();},function () {$('ul', this).hide();}); | |
| var img = new Image(); | |
| var num = Math.floor(Math.random() * 6+1); | |
| $(img).load(function() { | |
| $(this).hide(); | |
| $(".banner").removeClass("loading").append(this); | |
| $(this).show(); | |
| }).attr('src','/images/banner'+num+'.jpg'); | |
| // Navbar hover effects (for IE li:hover bug) | |
| $('.mainNav>li').hover(function(){ | |
| $(this).addClass('hoverCss'); | |
| },function(){ | |
| $(this).removeClass('hoverCss'); | |
| }) | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment