Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.3k views
in Technique[技术] by (71.8m points)

jquery - Foundation joyride start only on first load

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 settings are ...

$(window).load(function() {

    //Foundation Joyride (Tour)
    $("#tour").joyride({
        'cookieMonster': true,
        'cookieName': 'JoyRide',
        'cookieDomain': 'mydomain.co.uk/',
        'postRideCallback' : function () {
            $(this).joyride('destroy');
        },
        cookieMonster: false
    });

});
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...