简体   繁体   中英

User interaction on a page with tipsy

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);
});

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);
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM