Dear, I was tortured to look for the Internet in search of the desired manual or function. I decided to write. Tell me how to implement a simple function on jQuery. There is a link with the link
class and there is a div with the linc2
class. And now the function itself: when hovering over the link, a div should appear with the class linc2
, after which it was possible to hover the cursor and press something, but after the cursor leaves or goes to make it disappear again.
|
2 answers
<div id="place" style="width:300px; height:200px;"> <div class="link" style="width:300px; height:100px;">Link</div> <div class="linc2" style="width:300px; height:100px;background-color:green;display:none">Tooltip</div> </div> <script> $(function(){ $('#place').hover(function(){ $('.linc2').show(); }, function(){ $('.linc2').hide(); }); }); </script>
- non-figural imitation - Specter
- oneI mean, @Spectre? - Realetive__
- and what is incomprehensible? if
hover
hangs not on the link, but on the parent element of the link and block - Specter - and what is there, sorry, "nefigovogo"? You can hang an event on any DOM element. To be honest, just the first thing that came to mind. About
.mouseleave()
even somehow did not think. - Realetive__ - in my opinion, this is the case for all designers so - to make crutches using fixed element sizes, I don’t say that the decision is bad, I just don’t like it - Specter
|
Look here
|