Thanks... but i actually chose somewhat different approach : and it works too:
function movehere(el){ /* This bit is for moving the background of first ul - the lavalamp */ var w = $(el).width(); var pos = $(el).position(); var lleft = pos.left; $("li.back").animate({ width: w+"px", left:lleft+"px" }, 500); } $("ul.lavaLamp").hoverIntent(function(){ /* This part is for general wrapper and its only real purpose is to move lavalamp li back to its position when mouse leaves the menu. Without this wrapper the lavalamp li would keep hopping back and forwards between its home position and li where mousecursor is */ $(this).children("li").hoverIntent(function(){ /* opens menu when mouse cursor is over li */ $(this).children("ul.levTwo").slideToggle('medium'); /* aparently there is no need for if, since if there is nothing to select, then it fails silently */ el = $(this); movehere(el); }, function(){ $(this).children("ul.levTwo").slideToggle('medium'); }, 3, 100, 1000); },function(){ el = $("li.active"); /* and this part moves the lavalamp when cursor leaves menu */ movehere(el); }, 1000); And it works too... Alan. On Jun 27, 6:38 pm, Karl Swedberg <k...@englishrules.com> wrote: > Try this: > > if ( $('ul', this).length ) { > // do something if this li has a descendant ul > > } > > --Karl > > ____________ > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Jun 27, 2009, at 8:31 AM, zayatzz wrote: > > > > > Hello > > > I have function like this: > > > $("ul.lavaLamp li:has ul").hoverIntent(function(){ .... > > > For various reasons i need to run other functions in this hoverintent > > function, some functions need to be run for all lavalamp ul li's not > > only those that have ul's. Therefore i have to run hoverintent like > > this instead: > > > $("ul.lavaLamp li").hoverIntent(function() > > > But what is the shortest way to run certain functions on those li's > > that have uls. > > > if ($(this has:ul)) obviously does not work.. but is there a function > > that checks if element has certain children? something i could use > > like if ( $(this).has(element) ) > > > Alan