Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    341
    Thanks
    38
    Thanked 0 Times in 0 Posts

    JQuery Rollover Button Slow!

    Hi, I have created a navigation menu with images. So my code is here for one button image when hover, it changes to another image:

    $(document).ready (function () {
    $('.button').hover (function () {
    $(this).attr ('src', 'image1.jpg');}, function () {
    $(this).attr ('src', 'image.jpg');
    });
    });


    The hover works perfectly, but it is taking about 3 seconds to take effect, why?

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    maybes it's not caching the file. You would probably get better results by making 2 classes with the 2 images in them and then use addClass and removeClass

  • #3
    Regular Coder
    Join Date
    Sep 2011
    Posts
    341
    Thanks
    38
    Thanked 0 Times in 0 Posts
    Add class to what? the image? How?


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •