Foundation joyride start only on first load

后端 未结 2 1009
心在旅途
心在旅途 2020-12-20 06:42

I\'m using Foundation Joyride and every time I load the webpage the tour starts, but how do I only start the tour for the first time the webpage is loaded?

My settin

相关标签:
2条回答
  • 2020-12-20 07:34

    Got it working at last and it turned out to be the order in which the header files were declared.

    <html>
    <head>              
    <script type="text/javascript" src="jquery.js"></script>
    <link rel="stylesheet" type="text/css" href="foundation.css">
    <script type="text/javascript" src="foundation.min.js"></script>
    <script type="text/javascript" src="jquery.cookie.js"></script>
    <script type="text/javascript" src="jquery.foundation.joyride.js"></script>      
    <script>
        $(window).load(function() {
        $("#tour").joyride({
            cookieMonster: true,
            cookieName: 'JoyRide'
        });
      });
    </script>
    </head>
    <body>
        <ol id="tour">
            <li><p>This is the tour.</p></li>
        </ol>
    </body>
    </html>
    
    0 讨论(0)
  • 2020-12-20 07:44

    You have to use the cookieMonster option se to true, with your domain or false in cookieDomain.

    Also remove the cookieMonster: false outside of the parenthesis.

    To let joyride use cookies you must include the jQuery.cookie library in your page (https://github.com/carhartl/jquery-cookie)

    Here is a sample:

    $("#tour").joyride({
        cookieMonster: true,
        cookieName: 'JoyRide',
        cookieDomain: false
    });
    

    In this way you'll see the tour only the first time you visit the page (or when you clear the cookies).

    0 讨论(0)
提交回复
热议问题