Chaining is a good idea! I used your chain, but combined the addClass into a single line. eg "addClass('point-2 point-3')"
Cheers again! On Jan 15, 3:59 pm, Liam Potter <radioactiv...@gmail.com> wrote: > That always happens to me as well, as soon as I post something I'll > realise what I could do. > > But you can chain a quite a bit of this, make a bit more efficient > > $('ul.sub-text-points li a.point-1').hoverIntent(function() { > $('a.point-2, a.point-3').removeClass("current_point"); > $(this).addClass("current_point"); > $('p.point-1').fadeOut(300, function(){ > $(this).html('Changed > text').fadeIn(300).removeClass("point-1").addClass("point-2").addClass("point-3"); > });}, > function() { > > }); > davebowker wrote: > > Liam, > > > Thanks for your reply. As soon as I posted this I also had that idea. > > Guess a Mr Kipling and a coffee is brain food after all! > > > I haven't tried your code as I have it working now. Here's my code > > incase anyone else would like it. Cheers Liam. > > > $('ul.sub-text-points li a.point-1').hoverIntent(function() { > > $('a.point-2, a.point-3').removeClass("current_point"); > > $(this).addClass("current_point"); > > $('p.point-1').fadeOut(300, function(){ > > $(this).html('Changed text'); > > $(this).fadeIn(300); > > $(this).removeClass("point-1"); > > $(this).addClass("point-2"); > > $(this).addClass("point-3"); > > });}, > > function() { > > }); > > > On Jan 15, 3:41 pm, Liam Potter <radioactiv...@gmail.com> wrote: > > >> just noticed a mistake > >> forget to actually do anything with the if > >> try this > > >> $('ul.sub-text-points li a.point-1').hover(function() { > >> if ( $(this).attr("class") == "current_point") { } > >> else{ > >> $('a.point-2, a.point-3').removeClass("current_point"); > >> $(this).addClass("current_point"); > >> $('p.sub-text').fadeOut(300, function(){ /* Looks like this is the > >> start of the problem? */ > >> $(this).html('Changed text'); > >> $(this).fadeIn(300); > >> });}, > >> function() { > > >> }); > >> } > >> Liam Potter wrote: > > >>> here is some untested code > > >>> $('ul.sub-text-points li a.point-1').hover(function() { > >>> if ( $(this).class("current_point") {} > >>> else{ > >>> $('a.point-2, a.point-3').removeClass("current_point"); > >>> $(this).addClass("current_point"); > >>> $('p.sub-text').fadeOut(300, function(){ /* Looks like this is the > >>> start of the problem? */ > >>> $(this).html('Changed text'); > >>> $(this).fadeIn(300); > >>> });}, > >>> function() { > >>> }); > >>> } > > >>> like I say, untested, but should give you a starting point. > > >>> Liam Potter wrote: > > >>>> You could add a class say, "nochange" check for that on hover, if > >>>> found, no dothing, if not, continue to change. > > >>>> davebowker wrote: > > >>>>> Hey, > > >>>>> I'm trying to get a little hover script running. It's using the > >>>>> hoverIntent plugin, but substituting that for hover will work for this > >>>>> example. > > >>>>> What I'm trying to do is hover a link which will fade out a paragraph, > >>>>> change the contents of that paragraph, and then fade that paragraph > >>>>> back in. I have that working in my code so far. > > >>>>> The bug I'm trying to fix is that when I hover over the now active > >>>>> link again, it repeats the fadeOut > change contents > fadeIn script > >>>>> again, but as the content has already been changed it just becomes an > >>>>> annoying fadeOut fadeIn effect. > > >>>>> Any help would be greatly appreciated. > > >>>>> Here's my code. > > >>>>> $('ul.sub-text-points li a.point-1').hover(function() { > >>>>> $('a.point-2, a.point-3').removeClass("current_point"); > >>>>> $(this).addClass("current_point"); > >>>>> $('p.sub-text').fadeOut(300, function(){ /* Looks like this is the > >>>>> start of the problem? */ > >>>>> $(this).html('Changed text'); > >>>>> $(this).fadeIn(300); > >>>>> });}, > >>>>> function() { > >>>>> });