Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to initiate Nivo Slider in ajax loaded content?
    primarykey
    data
    text
    <p>I am having trouble getting Nivo slider to initiate when the page containing it had been loaded by ajax.</p> <p>Here is the HTML</p> <pre><code>&lt;div class="work"&gt; &lt;img class="introPic" src="images/thumb.jpg" width="250" height="99" /&gt; &lt;h3&gt;&lt;img class="arrow" src="images/arrow_open.gif" alt="&amp;gt;" /&gt; &lt;a class="titlelink" href="testcontent4.html" rel="address:testcontent4.html"&gt;Nivo Slider Project&lt;/a&gt;&lt;/h3&gt; &lt;div class="projectIntro"&gt; &lt;p&gt;This is some intro text for Nivo Slider Project&lt;/p&gt; &lt;/div&gt; &lt;div class="pictures"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Here is the jQuery</p> <pre><code>$(function(){ function close_other() { var selected_work = $('.selected_work'); selected_work.children('.pictures').empty(); $('.selected_work img.arrow').attr("src", "images/arrow_open.gif"); selected_work.removeClass("selected_work"); } $('div.work a').click(function(e) { e.preventDefault(); }); $('div.work').bind('click', function() { $('html,body').animate({ scrollTop: $(this).offset().top }, 500); var href = $(this).find('a').attr('href'), lastPart = href.split('/'), hash = lastPart[lastPart.length - 1]; window.location.hash = hash; var parent = $(this); var content_holder = parent.children(".pictures"); if (parent.hasClass("selected_work")) { close_other(); return; } close_other(); parent.addClass("selected_work"); content_holder.load(href + ' #ajaxContent', function() { $(this).find('#slider').nivoSlider({ effect:'fade', //Specify sets like: 'fold,fade,sliceDown' animSpeed:300, pauseTime:4000, controlNav:true, pauseOnHover:true //Stop animation while hovering }); }); $('.selected_work img.arrow').attr("src", "images/arrow_close.gif"); }); }); </code></pre> <p>Here is a live demo: <a href="http://www.spiritlevel.co.uk/clicktest/divclicknivotest.html" rel="nofollow">http://www.spiritlevel.co.uk/clicktest/divclicknivotest.html</a> The "Nivo Slider Project" is the one I want to get working...</p> <p>Probably doing something basic wrong as i am new to jQuery so would appreciate any help you can give.</p> <p>Many thanks.</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. 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