jmpressjs / jmpress.js

A jQuery plugin to build a website on the infinite canvas
http://jmpressjs.github.com/jmpress.js
1.5k stars 237 forks source link

Dynamic data-src for subsequent steps #114

Closed husainhk closed 11 years ago

husainhk commented 11 years ago

Hi,

I have a series of slides, which are simple forms for users to make a choice (via radio buttons). The order of slides aren't pre-determined, since the subsequent slide depends on the user's choice.

How can I go about dynamically changing the data-src for the next slide?

Cheers, Husain

sokra commented 11 years ago

You can use jquery's data() function to change it: $(".thenextslide").data("src", "abc.html").

But this wouldn't take effect until the step is reinitialized. So deinit and init the step.

var slide = $(".thenextslide");
slide.data("src", "abc.html");
$(".jmpress").deinit(slide);
$(".jmpress").init(slide);
husainhk commented 11 years ago

Thanks sokra ... Would the solution you gave require all the steps to be part of the DOM on first load, with empty data-src?

For example:

step 1: div data-src=" " step 2: div data-src=" " step 3: div data-src=" " etc.

Thanks once again for your time!

sokra commented 11 years ago

no