-
Notifications
You must be signed in to change notification settings - Fork 502
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
When the 'a' tag has child elements the hover doesnt always work because of the event.target #153
Comments
Thanks for sharing the code! It's working for me! 👍 |
This has solved issues for me as well. Thanks for posting your fix. |
I don't understand... what element do you have that's triggering the hover? I didn't see the attributes to trigger it. I mean, with just that markup, it shouldn't work at all. |
Hi - I assume @aamjsadiq is referring to code within a Nav <li>, I have a similar scenario and his fix solved the intermittent hover issues for me. |
Hi @CWSpear , Sorry for posting a dummy code. The Actual code looks somewhat similar to below.
The issue happens when your mouse hover target is actually the span , as per existing code it checks whether the target is |
+1 |
We also needed this tweak, thanks! |
Exactly same issue, and this worked fine. Thanks. |
+1 |
@aamjsadiq can you provide a PR for this making it easier for @CWSpear to adopt it? |
@aamjsadiq thank you for this patch. Why is this issue still open? |
I guess a Pull Request would make it easier for the maintainer to merge... |
When i tried something like
And the icon and the span are block elements the hover doesnt always seems to work.
I figured its because of the event.target check thats been
if(!$parent.hasClass('open') && !$parent.is(event.target)) {
And
if(!$parent.hasClass('open') && !$this.is(event.target) )
By changing these to:
if(!$parent.hasClass('open') && !$.contains($parent[0], $(event.target)[0])) {
And
if(!$parent.hasClass('open') && !$.contains($this[0], $(event.target)[0])) {
Seems to be fixing the issue.
The text was updated successfully, but these errors were encountered: