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 11-29-2011, 07:28 AM   PM User | #1
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
fading an image out with jquery

hi i have an image actually an animated gif which i want to run through it's course then fade out. I think you can do that with jquery. someone was telling me to use a callback. i don't know how to use those. the image is logospining.gif. i want the image to load run it's animation then the rest of my page to load. i have all the html and css for the rest of the page. thank you. i looked on the jquery website but i've never used jquery before.
Repatilian is offline   Reply With Quote
Old 11-29-2011, 07:39 AM   PM User | #2
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
i think i could use the hide command too. I don't really know how to use it either. i tried to use this but it wouldn't display at all. i put this in the body.


Code:
<script src="jquery.js"></script>
<script>
<img id="book" src="logospining.gif" alt="" />


  $('#book').hide('slow', function() {
    alert('Animation complete.');
  });
});
</script>
Repatilian is offline   Reply With Quote
Old 11-30-2011, 03:52 PM   PM User | #3
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
the problem with what you want to do si the factt hat javascript/jQ has no way of knowing when the gif has finished it's first animation loop.

- a callback function isnt really going to help you in this case becuase that basically does "something" once the hide function has been completed, not the animation sequence.

- also you appear to have put your html inside of the javascript block

questions
- when do you want the image to display?
- how long, exactly, is the animated gif's animation sequence?
__________________
- 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 11-30-2011, 05:01 PM   PM User | #4
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,587
Thanks: 5
Thanked 864 Times in 841 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
You might have to create the spinning animation itself with JavaScript.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 12-01-2011, 04:43 AM   PM User | #5
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
Hi, i want a single animation to play threw at the beginning of my website then load everything else. Ok, here's what i want to use rollover buttons that actually have an animation when you mouse over the button then a different look when you click. I have all the code except for the animated button. I tried to use this code:
Code:
<a href="page.html" onmouseover="example.src='images/bt_rollover.jpg'" onmouseout="example.src='images/bt_normal.jpg'" onmousedown="example.src='images/bt_action.jpg'"><img src="images/bt_normal.jpg" alt="Image Alt text" name="example" width="100" height="100" border="0" /></a>
but when i added two buttons neither one would display. My website is at www.creationindex.com/indextest.html the rollover button is specified in the css but isn't set up to work. the two rollover files are profile.gif and profileover.gif. thank you.
Repatilian is offline   Reply With Quote
Old 12-01-2011, 06:32 AM   PM User | #6
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
the animation filename is logospining.gif
Repatilian is offline   Reply With Quote
Old 12-04-2011, 10:22 AM   PM User | #7
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
i got it fixed i used javascript
Code:
<a href="index.html"
><img src="profile.gif"  class="hide" border="0"
      onmouseover="this.src='profileani.gif';" onmouseout="this.src='profile.gif';"
></a>
and added an id.
Repatilian is offline   Reply With Quote
Reply

Bookmarks

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 10:52 PM.


Advertisement
Log in to turn off these ads.