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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    361
    Thanks
    39
    Thanked 0 Times in 0 Posts

    Unhappy JQuery Rollover button PROBLEMS!

    Hello, I'm having two problems in JQuery when doing a rollover image. Before I go further, let me write the code for the rollover:

    $(document).ready (function () {
    $("#button").hover(function () {
    $(this).attr("src", "images/button2.jpg");}, function () {
    $(this).attr("src", "images/button1.jpg");
    });
    });

    The code works perfectly, however, I have noticed that when hovering for the first time, or continue to hover each time quickly to test it, the hover effect is slow, I mean it takes about 1 or 1.5 seconds to take effect. But once I hover for the second time, it hovers normally. Why it is taking a little seconds for the hover to take effect for the first time?


    My second problem is weird. Take a look at this video which I have uploaded on YouTube to show the problem http://www.youtube.com/watch?v=5T-tv...ature=youtu.be This is the rollover button I made, but have you noticed my cursor? It is NOT on the button as you see but when I click beside the button, it goes to its destination. In fact as you see my cursor does change to 'Pointer'. I do not want that, I want only when I click on the button it goes to its destination. Here is the CSS code for it:

    #content img {
    display:block;
    margin:auto;
    }

    For the JQuery code, I already mentioned it above. HELP PLEASE!

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    We need to see your html/css to help you with the problem you are having in your video. As for the rollover can I ask why you are using jQuery for a rollover when html/css can get the job done just fine?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    show your html/css or a link to the page

  • #4
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    We need to see your html/css to help you with the problem you are having in your video. As for the rollover can I ask why you are using jQuery for a rollover when html/css can get the job done just fine?
    I was wondering as well. The required flash make me cringe too. I wish flash would crawl in a corner somewhere already .

  • #5
    Regular Coder
    Join Date
    Sep 2011
    Posts
    361
    Thanks
    39
    Thanked 0 Times in 0 Posts
    But I have already mentioned the CSS of the image button above. The HTML is <IMG SRC="XXX" ETC... that's all. I put it in the middle with CSS. The JQuery code for the rollover is also above. I know I could do it with CSS, but I want also to use the JQuery method for a navigation menu of another website which will consist of many buttons, and I do not want to use CSS. The problem is, it is slow before taking the hover takes effects if you click on the image button for the first time, but hovering normally after that. And in the video, the problem is weird. :s


  •  

    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
    •