Using a non-Squiffy link to advance the story...

I have a button and, when I click it, I would like Squiffy to advance to a section of my choosing. However, this button is in the main HTML template, not Squiffy itself. Do any of our resident Javascript / JQuery experts know how to do this?


Hi thetruespin!

To access squiffy object in your html, you may modify the story.js. On var methods you add the following code:

getSquiffy: function () {
   return squiffy;
},

After this, in the html button can place the following property:

<input type="button" onClick='jQuery.fn.squiffy("getSquiffy").story.go("clicked");' value="Click me!">

Then, when you click the button, the history advance to clicked section.


Brilliant. Thank you.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums