How to extract a specific text from an image?

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

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

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.