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

Give active step highest data-z? #140

Open TomRaas opened 10 years ago

TomRaas commented 10 years ago

I can make a kind of script where I can appand the attribute "data-z" to the active step by checking the hash in the link. But I'm wondering if there is a function in jmpress.js for this!

Hope somebody can help!

Thanks in advance!

Greetings, tom

sokra commented 10 years ago

You can use the secondary plugin to apply an alternative configuration when the step is active.

$("#jmpress").jmpress("apply", ".step", {
  secondary: "self",
  secondaryZ: 1000
});

If you want to change the configuration with a script:

$(".step").data("stepData").z += 1000;
$("#jmpress").jmpress("reapply", ".step")
TomRaas commented 10 years ago

Thanks for the kwnoledge but it is not working for me yet!

I tried to get the second code working, but I get the dollowing error in jmpress.js: TypeError: element.data is not a function ---> stepData: element.data("stepData")

The first option is only usable via template, but I dont use one. Can you tell me waht is best to do?

Gretting,

Tom

sokra commented 10 years ago
  1. The example is a template. apply applies a template (which is a javascript object, containing the values).
  2. http://api.jquery.com/data/ $("#jmpress").jmpress("reapply", $(".step"))