Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>But when I load the page the images are just stacked on top of one another, like the app can't find the javascript.</p> </blockquote> <p>This is because you need to initialize the orbit plugin at the right moment, that is when the html markup has being rendered into the DOM, read along how to do it.</p> <p>Basically what I've done was to create a <code>Ember.Component</code> <em>(but a view should also work)</em>, and put the orbit related markup directly in the component's template, then hook into the <code>didInsertElement</code> of the component and initialize the orbit plugin:</p> <h2>orbit-slider component template:</h2> <pre><code>&lt;script type="text/x-handlebars" id="components/orbit-slider"&gt; &lt;ul data-orbit&gt; &lt;li&gt;&lt;img src="http://placehold.it/400x240/#c2c2c9" class="carousel-pics"&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="http://placehold.it/400x240/#c2c2c9" class="carousel-pics"&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="http://placehold.it/400x240/#c2c2c9" class="carousel-pics"&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="http://placehold.it/400x240/#c2c2c9" class="carousel-pics"&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="http://placehold.it/400x240/#c2c2c9" class="carousel-pics"&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/script&gt; </code></pre> <h2>orbit-slider component class:</h2> <pre><code>App.OrbitSliderComponent = Ember.Component.extend({ initOrbit: function() { $(document).foundation('orbit', { animation: 'fade', timer_speed: 10000, pause_on_hover: true, resume_on_mouseout: false, animation_speed: 500, stack_on_small: true, navigation_arrows: true, slide_number: true, container_class: 'orbit-container', stack_on_small_class: 'orbit-stack-on-small', next_class: 'orbit-next', prev_class: 'orbit-prev', timer_container_class: 'orbit-timer', timer_paused_class: 'paused', timer_progress_class: 'orbit-progress', slides_container_class: 'orbit-slides-container', bullets_container_class: 'orbit-bullets', bullets_active_class: 'active', slide_number_class: 'orbit-slide-number', caption_class: 'orbit-caption', active_slide_class: 'active', orbit_transition_class: 'orbit-transitioning', bullets: true, timer: true, variable_height: false, before_slide_change: function(){}, after_slide_change: function(){} }); }.on('didInsertElement') }); </code></pre> <h2>usage in template</h2> <pre><code>... {{orbit-slider}} ... </code></pre> <p>As you can see I've used all possible configuration possibilities just to be sure it works, but of course you can omit them or change them accordingly.</p> <p>Here a working demo: <a href="http://jsbin.com/iciDiPI/2/edit">http://jsbin.com/iciDiPI/2/edit</a></p> <p>Hope it helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload