JQUERY MOUSEOVER FADES IN TWICE ONLY WANT ONCE

lois waisbrooker

Total Post:70

Points:494
Posted by  lois waisbrooker
JQuery  HTML  CSS 
 1055  View(s)
Ratings:
Rate this:
The version can be shown here. I want the existing text to fade out and the new text to fade in. For some reason this fades in twice weirdly.

$(window).load(function(){
var originalTitle = $('.Pinctitle').text();

$('body').on('mouseenter', '.Pselectorbutton', function(){
    var text = $(this).data('title');
    $('.Pinctitle').text(text);
});
$('body').on('mouseleave', '.Pselectorbutton', function(){
    $('.Pinctitle').text(originalTitle);
});
});
http://jsfiddle.net/ejnxyhke/
  1. Alex Leblois

    Post:67

    Points:471
    Re: JQuery mouseOver fades in twice only want once

    You may try this:

    $('body').on('mouseenter', '.Pselectorbutton', function(){
        var text = $(this).data('title');
        $('.Pinctitle').stop(1,1).animate({opacity: 0}, 'slow', function() {
            $(this).text(text);
        }).animate({opacity: 1}, 'slow');
    });
    Also another One.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!