I have a small hover script and it works like this: When I find a link to a link, it disappears in the corresponding div.
Now I tried to create a second link and set it to display the second div, and I succeeded, but when I find them fast one by one, it displays BOTH faded Divs and stay in place (with 2 divs instead of 1) until it returns first div.
I want to display only one div at a time when I find, even if I quickly find between links.
Here is the code:
<script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script>
<style>
#bank {display:none;}
</style>
<div><a href="#" id="btn">Show bank div and hide fancy div</a></div>
<div><a href="#" id="btn-bk">Show back and hid fancy div</a></div><br>
<div id="bank">Bank Div</div>
<div id="fancy">Fancy Div</div>
<script type="text/javascript">
//<![CDATA[
$(window).load(function(){
$('#btn').hover(function(e){
$('#fancy').fadeOut('slow', function(){
$('#bank').fadeIn('slow');
});
});
$('#btn-bk').hover(function(e){
$('#bank').fadeOut('slow', function(){
$('#fancy').fadeIn('slow');
});
});
/]]>
</script>
See in action: https://jsfiddle.net/rami7250/1jLtxdr7/