JS if there is a slider show it
<p>I'm no JS expert but I'm trying to alter this so that if there is a royalslider display it… if there isn't display the static image and the title and description. Any ideas as to why this isn't working? my head is currently spinning… I've left some space around the section I'm trying to add to the code under //royal slider fix and currently its just showing the title and description from the if statement. But, the markup is showing the slider div and outputting the code. </p>

<p>Any help would be very appreciated! You can preview this code and what I'm trying to do here... <a href="http://bvh.delineamultimedia.com/?page_id=2" rel="nofollow">http://bvh.delineamultimedia.com/?page_id=2</a></p>

<pre><code>;(function($) {

$.fn.SuperBox = function(options) {

    var superbox      = $('&lt;div class="superbox-show"&gt;&lt;/div&gt;');
    var superboximg   = $('&lt;img src="" class="superbox-current-img"&gt;');
    var superboxclose = $('&lt;div class="superbox-close"&gt;&lt;/div&gt;');

    superbox.append(superboximg).append(superboxclose);

    return this.each(function() {

        $('.superbox').on('click', '.superbox-list', function() {

            //allows for superbox to work inside of quicksand
            $('ul.filterable-grid').css({overflow: 'visible'});

            var currentimg = $(this).find('.superbox-img');
            superbox.find('.title').remove(); 
            superbox.find('.description').remove(); 

            var imgData = currentimg.data();
            superboximg.attr('src', imgData.img);
            if (imgData.title) { superbox.append('&lt;h3 class="title"&gt;'+imgData.title+'&lt;/h3&gt;'); }
            if (imgData.description) { superbox.append('&lt;div class="description"&gt;' + imgData.description + '&lt;/div&gt;'); }









//royal slider fix              
superbox.find('.royalSlider').remove(); // remove the slider from previous events
var imgData = currentimg.data();
var sliderData = currentimg.next('.royalSlider'); // grab the slider html that we want to insert

superboximg.attr('src', imgData.img); 

if (sliderData) { // show the slider if there is one
    superbox.clone().append(sliderData); // clone the element so we don't loose it for the next time the user clicks
} else { // if there is no slider proceed as before
    if (imgData.img) {
        superbox.append(imgData.img);
    }
    if (imgData.title) {
        superbox.append('&lt;h3 class="title"&gt;' + imgData.title + '&lt;/h3&gt;');
    }
    if (imgData.description) {
        superbox.append('&lt;div class="description"&gt;' + imgData.description + '&lt;/div&gt;');
    }
}












            if($('.superbox-current-img').css('opacity') == 0) {
                $('.superbox-current-img').animate({opacity: 1});
            }

            if ($(this).next().hasClass('superbox-show')) {
                superbox.toggle();
            } else {
                superbox.insertAfter(this).css('display', 'block');
            }

            $('html, body').animate({
                scrollTop:superbox.position().top - currentimg.width()
            }, 'medium');

        });


        $('.superbox').on('hover', '.superbox-list', function(e) {
            $(this).find('.overlay').stop()[(e.type == 'mouseenter') ? 'fadeIn' : 'fadeOut']('slow');
        });


        $('.superbox').on('click', '.superbox-close', function() {
            $('.superbox-current-img').animate({opacity: 100}, 200, function() {
                $('.superbox-show').slideUp();
            });
        });

    });
};

})(jQuery);
</code></pre>
