Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-07-2012, 08:31 PM   PM User | #1
angelali
Regular Coder

 
Join Date: Sep 2011
Posts: 310
Thanks: 23
Thanked 0 Times in 0 Posts
angelali is an unknown quantity at this point
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?
angelali is offline   Reply With Quote
Old 01-07-2012, 09:01 PM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
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
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 01-08-2012, 07:52 AM   PM User | #3
angelali
Regular Coder

 
Join Date: Sep 2011
Posts: 310
Thanks: 23
Thanked 0 Times in 0 Posts
angelali is an unknown quantity at this point
Add class to what? the image? How?
angelali is offline   Reply With Quote
Reply

Bookmarks

Tags
buttons, hover, jquery, rollover

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:36 PM.


Advertisement
Log in to turn off these ads.