I am using the jQuery bgFade Plugin and it fades the background image nicely but there’s a problem with it. It deletes everything that is in the div when you hover. You can see it here: http://weebuild1.yolasite.com/ (hover over the first box that says “Packages”)
This is the code:
<script type="text/javascript">
$(document).ready(function() {
$('.packages').hover(function() {
$(this).bgFade('fadeIn');
}, function() {
$(this).bgFade('fadeOut');
});
});
</script>
Can someone help me fix this issue? As you all know, this cannot stay like this. It needs to only fade the background and not remove the contents.
The plugin’s jQuery is here: http://weebuild1.yolasite.com/resources/javascript/jquery.bgFade.js
I hope someone can help. Thanks in advance!
I might even just forget about the fade plugin and do something like this.
Solution 1 ( uses
<img>)http://jsfiddle.net/yJHRA/3/ ( Should work ie6+. Not tested. )
HTML:
CSS:
jQuery:
Solution 2 ( uses background images)
http://jsfiddle.net/yJHRA/4/
HTML:
CSS:
jQuery:
Edit: Added
.stop()s so that if someone goes nuts with the hovering, the animation wont go nuts..Edit2: forgot that you have multiple boxes.. Fixed..
Edit3: Added solution 2 which uses background images.