Created
August 3, 2013 04:31
-
-
Save TechFounder/6145195 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
img { | |
cursor:pointer; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-latest.js"></script> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div class="loader"> | |
<p id='title'>Title</p> | |
<p id='body'>Body</p> | |
</div> | |
<img src="http://w3schools.com/images/compatible_safari.gif" class="something"/> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.something').hover(function() { | |
// set variables | |
loader = $('#title'), | |
loaderB = $('#body'), | |
origTxt = loader.text(), | |
origTxtB = loaderB.text(), | |
newTxt = 'New Title', | |
newTxtB = 'New Body'; | |
//on mouse over | |
loader.stop(true, true).fadeOut(600, function() { | |
$(this).text(newTxt); | |
}).fadeIn(600); | |
loaderB.stop(true, true).fadeOut(600, function() { | |
$(this).text(newTxtB); | |
}).fadeIn(600); | |
}, function() { | |
//on mouse out | |
loader.stop(true, true).fadeOut(600, function() { | |
$(this).text(origTxt); | |
}).fadeIn(600); | |
loaderB.stop(true, true).fadeOut(600, function() { | |
$(this).text(origTxtB); | |
}).fadeIn(600); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment