Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporate global behavior to highlight hovered-over items. #3

Open
salvamomo opened this issue Sep 4, 2017 · 0 comments
Open

Incorporate global behavior to highlight hovered-over items. #3

salvamomo opened this issue Sep 4, 2017 · 0 comments

Comments

@salvamomo
Copy link

salvamomo commented Sep 4, 2017

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.

      var mirageViewsRowClass = '.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');
      });```

Then had to implement something similar (equal except for the class names) for 
paragraphs, duplicating code. It's something rather trivial but will be probably common. 
Having a class makes it easier to target states within CSS, and also to keep it in line 
with BEM naming conventions.

Use this ticket to incorporate this logic, but also to start a simple but 
dev-friendly way to see usage, what JS utilities we have, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant