Title: another question about pro
Last modified: July 23, 2017

---

# another question about pro

 *  Resolved [Corrado Prever](https://wordpress.org/support/users/artphotoasia/)
 * (@artphotoasia)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/another-question-about-pro/)
 * hi Thomas, the pro version is now working fine, I have just a question.
 * I have a small script JQuery that allow me to add and format tooltip on the image.
 * Very simple
 *     ```
       jQuery('img.attachment-thumbnail').hover(
   
         	          function()  {
       		jQuery(this).parent().removeAttr('title');					
       		title = jQuery(this).attr('title');
       		alt = jQuery(this).attr('alt');
       		 jQuery(this).removeAttr('title');
        		 jQuery(this).removeAttr('alt');
          		 jQuery('<p class="tooltip"></p>').text(title).appendTo('body').fadeIn('slow');
            },
       	 	  function() {													
        		jQuery('.tooltip').remove();
       		jQuery(this).attr('title',title);
        		jQuery(this).attr('alt',alt );
            })
   
       	 .mousemove(function(pos) {
                var xx = pos.pageX + 20,
                    yy = pos.pageY + 10;
                jQuery('.tooltip').css({
                    top: yy,
                    left: xx,
                })
            });
       ```
   
 * All is fine unless I activate the Infinite Loading feature, in this case my script
   does not work on the image not loaded immediately on page load because they do
   not exist yet.
    Any idea to solve?

Viewing 12 replies - 1 through 12 (of 12 total)

 *  [Thomas](https://wordpress.org/support/users/kywyz/)
 * (@kywyz)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9344950)
 * Hello Corrado Prever,
 * Sorry, I’m currently on a one week trip without my computer, so i can’t test 
   anything !
 * However you are right, it is linked to the fact images are not in the DOM when
   page loads.
 * I will think about the solution and try it as soon as I have my computer back!
 * Sorry for the delay,
 * Best regards,
    Thomas.
 *  Thread Starter [Corrado Prever](https://wordpress.org/support/users/artphotoasia/)
 * (@artphotoasia)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9345611)
 * Thank you so much Thomas, take your time and have good trip.
 * Another thing, WPML support team finally solved the issue related compatibility
   WPML vs your renamer plugin.
 * They have sent to me and also to you (maybe to Jordy) the patched version of 
   the free plugin.
 * I tested and is working fine, so please just update in the next release, tell
   also Jordy about that.
 * IF you do not have the file let me know i will send to you.
 *  Thread Starter [Corrado Prever](https://wordpress.org/support/users/artphotoasia/)
 * (@artphotoasia)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9394866)
 * Hi there
 * Any news on that?
 * —-However you are right, it is linked to the fact images are not in the DOM when
   page loads—-
 *  [Thomas](https://wordpress.org/support/users/kywyz/)
 * (@kywyz)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9396562)
 * Hello Corrado Prever,
 * Sorry for the late reply, would it be possible to see a page where the problem
   occurs ?
 * I have a few ideas on why it couldn’t work and how to fix it but I need to see
   it live first !
 * Best regards,
    Thomas
 *  Thread Starter [Corrado Prever](https://wordpress.org/support/users/artphotoasia/)
 * (@artphotoasia)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9397499)
 * Hi Tomas
 * I have now activated the lazy load, you can see here …
 * [https://www.corradoprever.com/test3/fotografia/birmania-2011/bagan/](https://www.corradoprever.com/test3/fotografia/birmania-2011/bagan/)
 * After the line 4 of photos the tooltip stop to work because all the images after
   that line are not in the dom during the loading page.
 * The code of the script is
 *     ```
       jQuery('img.attachment-thumbnail').hover(
   
         	          function()  {
       		jQuery(this).parent().removeAttr('title');					
       		title = jQuery(this).attr('title');
       		alt = jQuery(this).attr('alt');
       		 jQuery(this).removeAttr('title');
        		 jQuery(this).removeAttr('alt');
          		 jQuery('<p class="tooltip"></p>').text(title).appendTo('body').fadeIn('slow');
            },
       	 	  function() {													
        		jQuery('.tooltip').remove();
       		jQuery(this).attr('title',title);
        		jQuery(this).attr('alt',alt );
            })
   
       	 .mousemove(function(pos) {
                var xx = pos.pageX + 20,
                    yy = pos.pageY + 10;
                jQuery('.tooltip').css({
                    top: yy,
                    left: xx,
                })
            });
       ```
   
 *  [Thomas](https://wordpress.org/support/users/kywyz/)
 * (@kywyz)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9400290)
 * Hello Corrado Prever,
 * I had a look at your website, could you try to add this code in your javascript:
 *     ```
       // Your script here
   
       $('.entry-content').bind('DOMNodeInserted', function(element){
               // Your script here again
       });
       ```
   
 * Note that I’ve used the default ‘.entry-content’ selector here, you should write
   the one you are actually using on your website.
 * It should normally rerun your script everytime the nodes are inserted inside 
   the DOM.
 * Cheers,
    Thomas
    -  This reply was modified 8 years, 11 months ago by [Thomas](https://wordpress.org/support/users/kywyz/).
 *  Thread Starter [Corrado Prever](https://wordpress.org/support/users/artphotoasia/)
 * (@artphotoasia)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9401379)
 * Hi Thomas, thank you for the answer but not solved yet.
 * .entry-content is ok as used in my template also.
 * It is better then before as the event is registered but start other problems,
   need to modify my script.
 * I will work on it, your idea is a good one
    -  This reply was modified 8 years, 11 months ago by [Corrado Prever](https://wordpress.org/support/users/artphotoasia/).
 *  Thread Starter [Corrado Prever](https://wordpress.org/support/users/artphotoasia/)
 * (@artphotoasia)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9405584)
 * Hi Thomas
    It was quite a complicated issue, anyway I wrote a new script with
   3 functions (mousenter, mouseleave, mousemove) using a correct ‘on’ event and
   using a father selector + a child secondary selector. It works perfectly now 
   also with lazyload and not yet loaded thb images.
 *     ```
       jQuery(".entry-content").on('mouseenter', 'img.attachment-thumbnail', function() {
       				miotitolo = mioalt = jQuery(this).attr('alt');
       				jQuery(this).parent().removeAttr('title');			 
        				jQuery(this).removeAttr('title');
       				jQuery(this).removeAttr('alt');
       				jQuery('<p class="tooltip"></p>').text(miotitolo).appendTo('body').fadeIn('slow');
       });
       jQuery(".entry-content").on('mouseleave', 'img.attachment-thumbnail', function() {
       				jQuery('.tooltip').remove();
       				jQuery(this).attr('title',miotitolo);
       				jQuery(this).attr('alt',mioalt );
       });
   
       jQuery(".entry-content").on('mousemove', 'img.attachment-thumbnail', function(pos) {
         				var xx = pos.pageX + 20;
       				var yy = pos.pageY + 10;
       				jQuery('.tooltip').css({
       										top: yy,
       										left: xx,
       										});
        				}); 
       ```
   
    -  This reply was modified 8 years, 10 months ago by [Corrado Prever](https://wordpress.org/support/users/artphotoasia/).
    -  This reply was modified 8 years, 10 months ago by [Corrado Prever](https://wordpress.org/support/users/artphotoasia/).
 *  [Thomas](https://wordpress.org/support/users/kywyz/)
 * (@kywyz)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9405877)
 * Hello Corrado Prever,
 * Oh did your last answer worked ?
 * Best regards,
    Thomas
 *  Thread Starter [Corrado Prever](https://wordpress.org/support/users/artphotoasia/)
 * (@artphotoasia)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9405915)
 * Hi there, your last answer actually didn’t, but with the re-script now is ok.
 *  [Thomas](https://wordpress.org/support/users/kywyz/)
 * (@kywyz)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9405919)
 * Yeah that’s what I meant !
 * Now that I see your answer it is indeed obvious haha !
 * This issue often happens with $(‘.something’).on(‘click’, function() {}); too,
   that you can then replace by $(document).on(‘click’, ‘.something’, function(){});
   to make it work on ajax loaded content.
 * But yeah, you found it before me !
 * I’m marking it as solved then,
 * Cheers,
    Thomas
 *  Thread Starter [Corrado Prever](https://wordpress.org/support/users/artphotoasia/)
 * (@artphotoasia)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9406063)
 * Sure is solved now!
 * Make me learning something more 🙂
 * Regards

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘another question about pro’ is closed to new replies.

 * ![](https://ps.w.org/meow-gallery/assets/icon-256x256.png?rev=2791571)
 * [Meow Gallery](https://wordpress.org/plugins/meow-gallery/)
 * [Support Threads](https://wordpress.org/support/plugin/meow-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/meow-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/meow-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/meow-gallery/reviews/)

 * 12 replies
 * 2 participants
 * Last reply from: [Corrado Prever](https://wordpress.org/support/users/artphotoasia/)
 * Last activity: [8 years, 10 months ago](https://wordpress.org/support/topic/another-question-about-pro/#post-9406063)
 * Status: resolved