0

Hello everyone,

I have one container div with several <div>About</div>, <div>More Info</div> etc. in it. on the main container I applied onmouseover to execute a JAVA function.
Apparently, every time I hover a <div> in the container it runs the JavaScript again.

What is it, I'm doing wrong? Thanks in advance!

3
Contributors
9
Replies
10
Views
6 Years
Discussion Span
Last Post by McLaren
0

what do you want to do exactly? onmouseover will run the function everytime the mouse is over the div. If you want to run it only once then you should have some variable maybe or hidden input field where you save that hte mouse has been already over this div and then not run the function again.

0

Thanks for your response, but I think I need to rephrase my question.
This is my HTML:

<div id="container" onmouseover="fade()">
<div id="fadeboxa">
<div class="list">About</div>
<div class="list">More Info</div>
<div class="list">Images</div>
</div>
</div>

Now instead of applying onmouseover only to "container" (Line 1) it is added to every element in that <div></div> (Line 2, 3, 4, 5). So every time I scroll over the <div> tags inside that "container", with my mouse, the box fades away. Is there a way I can apply the onmouseover only to the "container" and not to the "list".

1

mouse over works for items inside div .container.. because they ar inside that div :) if you have some area for which you want mouseover to work but not work on the other items, then you have to make one more div for that area. Something like this:

<div id="container" >   <!--here we don't call yet-->
<div class = "iwantmouseover" onmouseover="fade()">
  <!-- this is area you want mouse over to work -->
</div>

<div id="fadeboxa">
<div class="list">About</div>
<div class="list">More Info</div>
<div class="list">Images</div>
</div>
</div>

Edited by McLaren: n/a

0

Ah OK, I see! Is there even a way I can put <div></div> into my main container without mouseover applied to them and only to the <div id="container" onmouseover="fade()">...</div>.
They really are important for the layout but mess up on mouseover/mouseout. I did a little research and only found jQuery hacks.

But isn't there a plain JavaScript/CSS solution? It would be really helpful if you knew it :)

1

and only to the <div id="container" onmouseover="fade()">...</div>.

as I said it will work for that whole div and the items inside it. So you want to exclude items inside it?

Then maybe in fade() function you should check again if the mouse is over some area or not and then to one or another things depending on where the mouse is

1

i think .......SPeed_FANat1c....... is best suggest provider i see many threads and his suggest well and i think his suggest solved your problem.

0

i think .......SPeed_FANat1c....... is best suggest provider i see many threads and his suggest well and i think his suggest solved your problem.

thanks, but actually those problems which I solve are easy, I think I am far from the best, I just like sitting in forums, for me sometimes is more fun to discuss problems than solve my own ones :D I then I wonder why it takes so long for me to complete tasks :D But there definitely are much more experienced guys than me.

Those task which I help to solve may look difficult for not experienced people, but if you play around a little with jQuery you can get the priciples how it works :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.