jquery - Having javascript act on only one item in a list -


i have following code (coffeescript) , have rails creating list of subscription-videos , want popup popup on 1 hover over. since since every video in list has class subscription-video no matter hover on shows popup first one. best way have javascript define looking popup id in selected (one hovering over) subscription-video class?

$(document).ready ->   $('.subscription-video').hover (->     $('#popup').show()   ), ->     $('#popup').hide() 

you dom traversal. assuming subscription-video tag , popup in same div:

$(document).ready ->   $('.subscription-video').hover (->     $(this).closest('.popup').show()   ), ->     $(this).closest('.popup').hide() 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -