jquery - Trying to do onmouseover/onmouseout effect -


i'm trying achieve "circle/layer" effect (https://www.thinglink.com/)

my jquery skills terrible :( i've done, far...

html

<body style="margin:0; padding:0;"> <div class="container">     <div class="bubble-container bubble-a">         <a class="gps_ring" href="javascript:void(0);">             <div class="dot">dot</div>         </a>         <div class="layer">             <p>lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>         </div>     </div>     <div class="bubble-container bubble-b">         <a class="gps_ring" href="javascript:void(0);">             <div class="dot">dot</div>         </a>         <div class="layer">             <p>lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>         </div>     </div>     <div class="bubble-container bubble-c">         <a class="gps_ring" href="javascript:void(0);">             <div class="dot">dot</div>         </a>         <div class="layer">             <p>lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>         </div>     </div> </div> </body> 

css

.container { background-color:black; width:100%; height:400px; } .layer { background-color:#ffffff; display:none; position:absolute; top:-70px; right:20px; width:200px; height:200px; z-index:99999999; overflow:hidden; } .gps_ring {     border: 2px solid #ffffff;     padding:6px;     -webkit-border-radius: 30px;     height: 30px;     width: 30px;     display:block;     -webkit-animation: 0.6s pulsate infinite alternate ease-in-out;     -moz-animation: 0.6s pulsate infinite alternate ease-in-out;     -ms-animation: 0.6s pulsate infinite alternate ease-in-out;     -o-animation: 0.6s pulsate infinite alternate ease-in-out;     animation: 0.6s pulsate infinite alternate ease-in-out;     opacity: 0.0; } .gps_ring div.dot { background-color:transparent; width:100%; height:100%; -webkit-border-radius:30px; outline:none; text-indent:-9999px; } .gps_ring:hover div.dot { background-color:#ef4036; }  .bubble-container { position: absolute; }  .bubble-a {     left:150px;     top:100px; } .bubble-b {     left:250px;     top:260px; } .bubble-c {     left:350px;     top:180px; } @-webkit-keyframes pulsate {     0% {-webkit-transform: scale(1.0, 1.0); opacity: 1.0;}     50% {opacity: 1.0;}     100% {-webkit-transform: scale(1.3, 1.3); opacity: 1.0;} } 

jquery

$(".bubble-container .gps_ring").hover(function(){     $(this).next().show();     $(this).next().focus(); });  $(".layer").mouseleave(function(){     $(this).hide(); }); 

http://jsfiddle.net/j3d6ogu4/

sometimes white layer doesn't hide when mouse out, know why?

also, set red dot visible when on white layer too.

thank you!!

$(".bubble-container").hover(function(){     $(this).find('.gps_ring').next('.layer').show(); },function(){     $(this).find('.gps_ring').next('.layer').hide(); }); 

demo here

or can use .find()

$(".bubble-container").hover(function(){     $(this).find('.layer').show(); },function(){     $(this).find('.layer').hide(); }); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -