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

Inline Attributes Issue #75

Closed Pixelous closed 11 years ago

Pixelous commented 12 years ago

Hi, first of all thanks for excelent plugin. I have an issue with inline attributes. I develop a theme for a CMS, so I can't to set a different inline attributes for each steps. For example, I can have 3 steps or 33 steps that are setting up via admin area. There is some way to solve it? I was thinking that Templates http://dontkry.com/jmpress.js/docs/#docs-templates can help me but seems not.

shama commented 12 years ago

Sorry, I'm not understanding the issue. Why can't you set inline attributes?

Pixelous commented 12 years ago

I use WordPress, so my steps are the posts within the loop. It's just one line of code. I can't set different inline attributes, have u understand me? Maybe templates can help me? http://dontkry.com/jmpress.js/docs/#docs-templates

shama commented 12 years ago

Can you point me to a link with an example of the issue? If it's an issue setting up WordPress to produce the inline attributes, I won't be able to help as I don't use WordPress.

Templates are useful for setting inline attributes programmatically and may help this circumstance depending on your HTML.

Pixelous commented 12 years ago

Shama, every CMS have loops, u know they use php foreach. For example:


div id="jmpress"
    foreach $steps as $step {
            $ i= 0;
            $i++;
        div class="step"Slide $i/div
    /div
}

Hope, now u have undersood me? Should I use templates? I have tried to use them but no luck, any help please?

shama commented 12 years ago

Yes I understand programming languages have loops :) What I don't understand is the issue you are having with jmpress.js.

If you're using PHP to build your HTML, why can't you do:

foreach ($steps as $step) {
  echo '<div class="step" data-x="' . $step['x'] . '" data-y="' . $step['y'] . '">';
  echo $step['content'];
  echo '</div>';
}

Please remember the above example is relies upon you creating the $steps array.

Pixelous commented 12 years ago

Yep, but if I want to hardcode my inline attributes? Will templates help me? http://dontkry.com/jmpress.js/docs/#docs-templates I was trying this:

$.jmpress("template", "mytemplate", { children: function( idx, current_child, children ) { return { y: 400 ,x: -300 + idx * 300 ,template: "mytemplate" ,scale: 0.3 } } });

but no luck.

shama commented 12 years ago

Hardcode? Use HTML: <div class="step" data-x="100" data-y="100">Content</div>. Templates are for setting the attributes programmatically using jmpress and JavaScript and have nothing to do with WordPress or PHP.

Pixelous commented 12 years ago

How could I use this:

$.jmpress("template", "mytemplate", { children: function( idx, current_child, children ) { return { y: 400 ,x: -300 + idx * 300 ,template: "mytemplate" ,scale: 0.3 } } });

Any help?

shama commented 12 years ago

Without seeing a link to an example of the specific issue you are having with jmpress.js I cannot help you.

sokra commented 12 years ago

I neither unterstand the issue and a example would be great.

The guy in this video integrated jmpress.js with drupal (CMS): http://www.youtube.com/watch?v=s1BamZ6YppU

shama commented 11 years ago

Closing. Please reopen if you still need assistance. Thanks!