Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Cross-Fade Image Transition Menu; Tutorials?
Old 02-23-2011, 01:09 PM Cross-Fade Image Transition Menu; Tutorials?
Novice Talker

Posts: 13
Trades: 0
Can anyone recommend a really nice tutorial on how to create a menu with cross-fade image transition with 2 separate images (instead of using sprite images-- seems to be messing up the flow when I try that)? The following is functional, but all the initial images are overlapping and stuck on top of one another. I can't get the initial (not bkgrd) images to position correctly without breaking functionality (tried adding in... top:?px left: ?px to each of the fade1, fade2, fade3 classes). Here's the original script that I implemented (from Jquery for designers site). I'm still quite the newb...

Quote:
<script type="text/javascript">
<!--
$(function () {
$('img.fade').each(function () {
var $$ = $(this);

var target = $$.css('background-image').replace(/^url|[\)\(]/g,'');

$$.wrap('span style="position: relative;"></span>')
.parent() // span elements
.prepend('<img>')
.find('img:first') //selector now new image
.attr('src', target);

$$.css({
'position' : 'absolute',
'left' : 0,
'top' : this.offsetTop
});

$$.hover(function () {
$$.stop().animate({
opacity: 0
}, 250);
}, function () {
$$.stop().animate({
opacity: 1
}, 3000);
});
});
});
--></script>

and HTML...

<div id="artmenu">

<div class="fademenu">
<a href="#sitelink"><img class="fade1" src="images/menu_sitea.png" border="0" style="background-image: url(images/menu_siteb.png)" border="0"/></a>
<a href="#printlink"><img class="fade2" src="images/menu_printa.png" border="0" style="background-image: url(images/menu_printb.png)" border="0" /></a>
<a href="#illustlink"><img class="fade3" src="images/menu_illa.png" border="0" style="background-image: url(images/menu_illb.png)" border="0" /></a>
</div>

</div>

CSS:
.fade1 {
left: 21px;
top: 3px;}
.fade2 {
left: 290px;
top: 2px;}
.fade3 {
left: 525px;
top: 2px;}
paintedcorner is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-01-2011, 04:27 PM Re: Cross-Fade Image Transition Menu; Tutorials?
Skilled Talker

Posts: 90
Name: Lisa Forgan
Location: Colorado
Trades: 0
Try this method:

javascript code:
(you'll also need to get download the most recent verson of the jquery.js file from jquery.com). Place this in a separate javascript file:
jQuery(document).ready(function(){
//Fade Effect
jQuery(".fade span").css("opacity","0");
jQuery(".fade span").hover(
function () {
jQuery(this).stop().animate({
opacity: 1
}, "slow");
},
function () {
jQuery(this).stop().animate({
opacity: 0
}, "slow");
}
);
}); // the closing bracket to the document ready function

css code:
.fade1Btn {
cursor: pointer;
background: url(../images/menu_sitea.png) 0 0px no-repeat;
height:26px; /*adjust this to the width and height of your image*/
width:118px; /*adjust this to the width and height of your image*/
}

.fade1Btn span {
display:block;
text-indent:-99em;
width:118px; /*adjust this to the width and height of your image*/
height:26px; /*adjust this to the width and height of your image*/
background: url(../images/menu_siteb.png) 0 0px no-repeat;
/* You could also use image sprites and change the background position
background: url(../images/menu_sitea.png) 0 -26px no-repeat;*/
cursor: pointer;

}

HTML Code:
<a href="#" class="fade1Btn fade clearfix"><span></span></a>

Last edited by Puddlemut; 03-01-2011 at 04:29 PM..
Puddlemut is offline
Reply With Quote
View Public Profile
 
Old 03-01-2011, 06:12 PM Re: Cross-Fade Image Transition Menu; Tutorials?
DmitryS's Avatar
Skilled Talker

Posts: 84
Trades: 0
please try below tutorial it seems helpful

http://www.lastbeatniks.tk/free-image-cross-fade/
__________________
»
Please login or register to view this content. Registration is FREE
for web developers
»
Please login or register to view this content. Registration is FREE
- Interactive maps for websites
DmitryS is offline
Reply With Quote
View Public Profile
 
Old 03-02-2011, 08:08 PM Re: Cross-Fade Image Transition Menu; Tutorials?
Novice Talker

Posts: 13
Trades: 0
Thanks, Puddle!

It's working beautifully!!!! I can't tell you how much I appreciate the help. Seems much more lightweight than the other code I'd tried as well.

paintedcorner is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Cross-Fade Image Transition Menu; Tutorials?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16399 seconds with 11 queries