Linto
Linto

Reputation: 1282

Tooltipser popup not working for the first mouse over

I am using Tooltipser popup in my page.

And the content of tooltipser is updating by ajax.

They are working well, if there is no image in the content.

But if there is an image in the ajax content, then the position of tooltipser for the first time is not correct. But from the second time onwards, it comes on correct position (ie on top position)

Can any one know the reason?

Following is my code

<script>

$(document).ready(function() {
$('#test_link').tooltipster({
    interactive:true,   
    content: 'Loading...',
    functionBefore: function(origin, continueTooltip) {

        // we'll make this function asynchronous and allow the tooltip to go ahead and show the loading notification while fetching our data
        continueTooltip();

        // next, we want to check if our data has already been cached
        //if (origin.data('ajax') !== 'cached') {
            $.ajax({
                type: 'POST',
                url: 'example.php',
                success: function(data) {
                    // update our tooltip content with our returned data and cache it
                    origin.tooltipster('content', $(data)).data('ajax', 'cached');
                }
            });
      //  }
    }
});
     });
    </script>

example.php

<?php
echo "<img src='flag.jpg'>";
?>

Upvotes: 1

Views: 647

Answers (1)

Louis Ameline
Louis Ameline

Reputation: 2889

this is answered in the github issues list. https://github.com/iamceege/tooltipster/issues/111

Upvotes: 1

Related Questions