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

thetruespin
23 Apr 2017, 20:33

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?


manowar
23 Apr 2017, 22:50

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.


thetruespin
24 Apr 2017, 06:09

Brilliant. Thank you.