1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
|
//******** LOAD LATEST POST IN MAIN MENU *******************************************************************************************/
var item
jQuery.noConflict()(function($){
$(document).ready(function(){
//When the mouse leave the menu area, hide the menu
$('.menu-top').mouseleave(
function(){
clearTimeout(timer);
timer = setTimeout(function() {
$("#querySort").stop().animate({opacity: 0, height: '0px'}, 400,'swing',function(){
var hideList = $('.snav');
for(j=0; j<hideList.length; j++)
{
var h = hideList[j];
$(h).css('display','none');
}
});
}, 500);
return false;
}
);
var items = $('.fnav>li.menu-item');
//alert(items);
for(i=0; i<items.length; i++)
{
item = $(items[i]); // convert to a jquery element in order to use jquery methods
//alert(item);
var id=item.attr('id');
id+="-child";
var child=item.find('.snav');
child.css('display','none');
//child.addClass(id,'child-menu');
child.addClass(id);
//child.addClass('child-menu');
child.appendTo('#submenu-items');
item.mouseenter(function(){
var hideList = $('.snav');
for(j=0; j<hideList.length; j++)
{
var h = hideList[j];
$(h).css('display','none');
}
var me = $(this); // to call the element from inside its function
var id=me.attr('id');
var childClass='.'+id+'-child';
//alert(childClass);
$(childClass).css('display','');
//height = $("#queryContainer").height() + 'px';
//height = $(childClass).height() + 100 + 'px';
height = 'auto';
$("#querySort").stop().animate({height:height, opacity: 1}, 400);
//sleep(1000);
//alert(childClass);
/*
$(childClass).stop().fadeOut(200,
function(){
$("#submenu-items").stop().fadeIn(200)
}
)
*/
//$("#submenu-items").animate({opacity: 0}, 400);
$(childClass+'>li:first-child').trigger('mouseenter');
})
}
// });
//jQuery(function($) {
var timer;
var request;
var parent;
// replace these default settings with your own
$.querySort = {
path_to_template: 'http://newradio.aurovilleradiotv.org/wp-content/themes/valor/',
number_of_posts: 4,
default_category: ''
}
$("#querySort").css({opacity: 0, height: '0px'});
//functions for the sorter
$(".snav li").mouseenter(
function(){ //hover In
if(timer) {
clearTimeout(timer);
timer = null
}
var thecat = $(this).attr("data");
var query = 'query=showposts%3D' + $.querySort.number_of_posts + '%26category_name%3D' + thecat;
$("#querySort").stop().animate({opacity: 0}, 400);
if ( request != undefined )
{
request.abort();
}
request = $.ajax({
type: "GET",
url: $.querySort.path_to_template + 'querySort.php',
data: query,
success: function(msg){
$("#querySort").html( msg );
$(".submenu-entry").hover(
function(){
if(timer) {
clearTimeout(timer);
timer = null
}
return false;
}
);
height = $("#queryContainer").height() + 'px';
$("#querySort").stop().animate({height:height, opacity: 1}, 400);
}
});
/*
$("#querySort").load($.querySort.path_to_template + 'querySort.php' + query, function() {
$(".submenu-entry").hover(
function(){
if(timer) {
clearTimeout(timer);
timer = null
}
return false;
},
function(){
clearTimeout(timer);
timer = setTimeout(function() {
$("#querySort").stop().animate({opacity: 0, height: '0px'}, 400);
}, 500);
return false;
}
);
height = $("#queryContainer").height() + 'px';
$("#querySort").stop().animate({height:height, opacity: 1}, 400);
});
*/
return false;
} /*,
function(){ //hover Out
timer = setTimeout(function() {
$("#querySort").stop().animate({opacity: 0, height: '0px'}, 400);
}, 500);
return false;
} */
);
});
}) |
Partager