Question

Is there a way I can trace what the user does on the page. Mainly I want to do the following thing: User opens a page, if he does not click anywhere on that page to show a tooltip (i'm using tipsy) guiding him which parts are clickable.

So far I've tried several stuffs:

  1. I have set tipsy to show manually: trigger:manual;
  2. I made a variable that equals false until the user clicks those clickable items (divs and images)
  3. If the variable is false, show the tooltip (tipsy).

But I'm missing something because this doesn't work. Here is my code.

$(document).ready(function() {
    var userClick = false;

    function showTooltips() {
        $(document).ready(function()) {
            if(userClick === false)
                $('.nickname .pseudo-white').tipsy('show');
    }

    setTimeout(showTooltips(), 5000);
});
Was it helpful?

Solution

Try getting rid of the extra call to $(document).ready, and pass the function name to setTimeout rather than calling it with ()

$(document).ready(function() {
    var userClick = false;

    function showTooltips() {
            if(userClick === false)
                $('.nickname .pseudo-white').tipsy('show');
    }

    setTimeout(showTooltips, 5000);
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top