[26889] | 1 | /* |
---|
| 2 | * menu - v1.0 - 2013-10-01 |
---|
| 3 | * plugin menu for piwitheme |
---|
| 4 | * http://piwitheme.fr/ |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | (function($) { |
---|
| 9 | $('li.liSub:last-child dt').addClass('dd_wrapper'); |
---|
| 10 | $('li.liSub:last-child dd').addClass('sub'); |
---|
| 11 | $('.mcol').columnize({ |
---|
| 12 | columns : 4, |
---|
| 13 | doneFunc : function(){ |
---|
| 14 | $('.sub').hide(); |
---|
| 15 | } |
---|
| 16 | }); |
---|
| 17 | $.each($('.mcol li'), function() { |
---|
| 18 | var $li = $(this), |
---|
| 19 | $test=$li.find('a'); |
---|
| 20 | if($test.length == 0){ |
---|
| 21 | $li.remove() |
---|
| 22 | } |
---|
| 23 | }) |
---|
| 24 | |
---|
| 25 | $('#topnav li').each(function(){ |
---|
| 26 | if($(':first-child', this).hasClass('cl_wrapper')){ |
---|
| 27 | $(this).addClass('ident'); |
---|
| 28 | } else{ |
---|
| 29 | $(this).addClass('menu') |
---|
| 30 | } |
---|
| 31 | }); |
---|
| 32 | |
---|
| 33 | function megaHoverOver(){ |
---|
| 34 | $(this).addClass('activate').find('.sub').stop().slideDown(200); |
---|
| 35 | }; |
---|
| 36 | |
---|
| 37 | function megaHoverOut(){ |
---|
| 38 | $(this).find('.sub').stop().slideUp(200,function(){$(this).parent().removeClass('activate')}); |
---|
| 39 | }; |
---|
| 40 | var $configSub = { |
---|
| 41 | over : megaHoverOver, |
---|
| 42 | out : megaHoverOut |
---|
| 43 | }; |
---|
| 44 | |
---|
| 45 | $('.menu').hoverIntent($configSub); |
---|
| 46 | $('.sub ul li:last-child a').css('border', 'none'); |
---|
| 47 | |
---|
| 48 | $('.ident').mouseenter(function(){ |
---|
| 49 | if($(this).children('div').is(':hidden')){ |
---|
| 50 | $(this).addClass('activate').children('div').slideDown(200).attr(':visible'); |
---|
| 51 | } |
---|
| 52 | }); |
---|
| 53 | $('.cl_wrapper').click(function(){ |
---|
| 54 | if($(this).next('div').is(':visible')){ |
---|
| 55 | $(this).next('div').slideUp(200, function(){ |
---|
| 56 | $(this).hide() |
---|
| 57 | }); |
---|
| 58 | $(this).next('div').attr(':hidden'); |
---|
| 59 | $(this).parent().removeClass('activate'); |
---|
| 60 | } |
---|
| 61 | }); |
---|
| 62 | $('.close').click(function(){ |
---|
| 63 | $(this).parent().slideUp(200, function(){ |
---|
| 64 | $(this).hide().attr(':hidden') |
---|
| 65 | }); |
---|
| 66 | $('.ident').removeClass('activate'); |
---|
| 67 | }); |
---|
[28049] | 68 | |
---|
| 69 | $('#qsearchInput').attr('value',qsearch_prompt); |
---|
| 70 | |
---|
[26889] | 71 | $('#qsearchInput').focus(function(){ |
---|
[28049] | 72 | if($('#qsearchInput').val() == qsearch_prompt){ |
---|
| 73 | $('#qsearchInput').val('') |
---|
[26889] | 74 | } |
---|
| 75 | }); |
---|
[28049] | 76 | |
---|
[26889] | 77 | $('#qsearchInput').blur(function(){ |
---|
[28049] | 78 | if($('#qsearchInput').val() != qsearch_prompt){ |
---|
| 79 | $('#qsearchInput').val(qsearch_prompt) |
---|
[26889] | 80 | } |
---|
| 81 | }); |
---|
| 82 | |
---|
| 83 | })(jQuery); |
---|