Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery - background fade.
    primarykey
    data
    text
    <p>I'm trying to make a background fade in when you mouse over a box. </p> <p>Box1 is the box I mousesover, and hover1 is the new background that comes in. This actually works pretty well. However, it loads the acript, meaning, that if i go crazy with my mouse over the box, the fadeing will continue endless, even when my mouse is standing still. I need to add some kind of stop function.. Content is a text that changes in a contentbox when I mouseover. This works fine.</p> <pre><code>$("#box1").mouseover(function(){ $("#background").switchClass("nohover", "hover1", 500); $("#content").html(box1); }); $("#box1").mouseout(function(){ $("#background").switchClass("hover1", "nohover", 150); $("#content").html(content); }); </code></pre> <p>I've also tried with var, but I still have the same problem. If I mouseover fast, the fading keeps running.</p> <pre><code> var goeft = 0; $("#box1").mouseover(function(){ if(goeft == 0) { $("#background").switchClass("nohover", "hover1", 500); $("#content").html(box1); goeft = 1; } }); $("#box1").mouseout(function(){ $("#background").switchClass("hover1", "nohover", 150); $("#content").html(content); goeft = 0; }); </code></pre> <p>Css code -v-</p> <pre><code> /* CSS Document */ body { background-color:#B1EB78; } #wrapper { border:5px white solid; border-radius:15px; background-image:url(../images/mill.jpg); } #header { height:120px; background-image:url(../images/logo.png); background-repeat:no-repeat; } #content { height:250px; background-image:url(../images/trans_white.png); border:1px black solid; border-radius:5px; } #space { height:40px; } #space2 { height: 10px; } #box1 { height:250px; background-image:url(../images/trans_green.png); } #background { width:100%; height:100%; border-radius:9px; } .hover1 { background-color:red; } .nohover { } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload