jQuery: How to disable the hover event when I hover over the text inside the image?
-
I have a problem in my code, when I hover over the image, the image will become 50% larger and it will display a text over the image, but when I hover over the text, the image will enter the state of mouseout, mouseover, mouseout, mouseover. So it will flicker a lot. How can I disable this hovering event when the mouse is over the text of the image? I tried event.stopPropagation in the text but it isn't working. Here's the http://jsfiddle.net/Z7C4b/ . Try to hover over the image, then try to hover over the text. That's the effect I'm talking about. I want to disable the text hover event. Please help me.
-
Answer:
I would do something like this. Instead of using the hover effect on the img element, do it on the parent, the $('.imgwall') and then to increase just the image do a $(this).find('img').<apply_css> and $(this).find('h2').show()/hide() to show the text inside the hover event. You should really consider refactoring that code though. Always save $(this) into a var instead of jumping into the DOM every time to fetch it. Something like var $this = $(this) should work fine.
Bogdan Lazar at Quora Visit the source
Related Q & A:
- How to show text inside a progressbar?Best solution by Stack Overflow
- How do I search for text inside a PDF?Best solution by Stack Overflow
- How to set up picture alerts when I have mail?Best solution by Yahoo! Answers
- How to change my display name when I send mail in yahoo?Best solution by Yahoo! Answers
- How can I get a text alert when I get an email?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.