You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This started as something for scaling background in bspweb. It simply adds a class to a given DOM element whenever any of its child items is on hover. This is useful because sometimes you want to apply css effects on the parent item when it's hovered, but passing over child items might make it lose the ":hover" meta state.
varmirageViewsRowClass='.mirage-views-row-hover .views-row';$(mirageViewsRowClass).bind('mouseenter',function(e){$(e.target).closest('.views-row').addClass('row-hovered');});$(mirageViewsRowClass).bind('mouseleave',function(e){$(e.target).closest('.views-row').removeClass('row-hovered');});```
Thenhadtoimplementsomethingsimilar(equalexceptfortheclassnames)forparagraphs,duplicatingcode.It's something rather trivial but will be probably common.
HavingaclassmakesiteasiertotargetstateswithinCSS,andalsotokeepitinlinewithBEMnamingconventions.Usethistickettoincorporatethislogic,butalsotostartasimplebutdev-friendlywaytoseeusage,whatJSutilitieswehave,etc.
The text was updated successfully, but these errors were encountered:
This started as something for scaling background in bspweb. It simply adds a class to a given DOM element whenever any of its child items is on hover. This is useful because sometimes you want to apply css effects on the parent item when it's hovered, but passing over child items might make it lose the ":hover" meta state.
The text was updated successfully, but these errors were encountered: