Zdravím,
potreboval by som menšiu výpomoc... robím JQuery menu, všetko fachčí ako má, až na lightbox (lavalamp)... proste prejde to nad daný element zoznamu (<li>), ale najprv skočí na prvý element a potom hneď nad daný... a nad prvý by malo len ak neni ani nad jedným z elementov myš...
kód
ale nejde to ani s podmienkou pre mouseoverKód:$(function(){ $("li").mouseenter(function(){ var pos = $(this).position().left-(($(window).width()-$("#menu").width())/2-5); var mar = new String($(this).css("marginLeft")); var marg = mar.replace("px",""); var wd = $(this).width()+marg*2; $("#light").stop(true,true); $("#light").animate({marginLeft:pos,width:wd},"medium"); $(this).find("div").css("visibility","visible"); $(this).find("div").stop(true,true); $(this).find("div").slideDown("slow"); }).mouseleave(function(){ var pos = $("li:first").position().left-(($(window).width()-$("#menu").width())/2-5); var mar = new String($("li:first").css("marginLeft")); var marg = mar.replace("px",""); var wd = $("li:first").width()+marg*2; $("#light").stop(true,true); $("#light").animate({marginLeft:pos,width:wd},"medium"); $(this).find("div").stop(true,true); $(this).find("div").slideUp("slow",function(){ $(this).find("div").css("visibility","hidden"); }); }); });
a je jedno či if(!($("li").mouseover())) alebo if(!($("li:hover"))), efekt ten istý... a s podmienkou dokonca nefunguje ani slideUp().. ak sa dakto z vás v tom vyzná lepšie ako ja, alebo vám chyba až bije do očí, prosím pomôžteKód:$(function(){ $("li").mouseenter(function(){ // mouse in }).mouseleave(function(){ if(!($("li").mouseover())){ var pos = $("li:first").position().left-(($(window).width()-$("#menu").width())/2-5); var mar = new String($("li:first").css("marginLeft")); var marg = mar.replace("px",""); var wd = $("li:first").width()+marg*2; $("#light").stop(true,true); $("#light").animate({marginLeft:pos,width:wd},"medium"); $(this).find("div").stop(true,true); $(this).find("div").slideUp("slow",function(){ $(this).find("div").css("visibility","hidden"); }); } }); });
demo nájdete TU


