重新加载超级!幻灯片转换错误

时间:2012-06-08 11:43:57

标签: jquery supersized

使用Supersized时遇到问题!插件并替换图像。我遇到的问题是,当我重新加载幻灯片时,从幻灯片到幻灯片的转换会以指数方式加快。

要复制问题,请单击项目导航,然后单击子菜单项并加载下一个幻灯片,每次单击一个幻灯片时,每次过渡都会跳过更多幻灯片。

以下是网站http://www.liquidvision.co.uk/clients/wattsconstruction/

以下是影响的主要代码:

我创建了图像阵列:

var homeImages = [  
                    {image : 'img/1.jpg', title : '', thumb : 'img/thumbs/1.jpg', url : ''},
                    {image : 'img/2.jpg', title : '', thumb : 'img/thumbs/2.jpg', url : ''},
                    {image : 'img/3.jpg', title : '', thumb : 'img/thumbs/3.jpg', url : ''},
                    ];

var home = $.makeArray(homeImages);

var secondImages = [    
                    {image : 'img/4.jpg', title : '', thumb : 'img/thumbs/4.jpg', url : ''},
                    {image : 'img/5.jpg', title : '', thumb : 'img/thumbs/5.jpg', url : ''},
                    {image : 'img/6.jpg', title : '', thumb : 'img/thumbs/6.jpg', url : ''},
                    ];

var second = $.makeArray(secondImages);

然后设置主页Supersized幻灯片

$.supersized({

    // Functionality
    slideshow               :   1,          // Slideshow on/off
    autoplay                :   1,          // Slideshow starts playing automatically
    start_slide             :   0,          // Start slide (0 is random)
    stop_loop               :   0,          // Pauses slideshow on last slide
    random                  :   0,          // Randomize slide order (Ignores start slide)
    slide_interval          :   3000,       // Length between transitions
    transition              :   1,          // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
    transition_speed        :   500,        // Speed of transition
    new_window              :   1,          // Image links open in new window/tab
    pause_hover             :   0,          // Pause slideshow on hover
    keyboard_nav            :   1,          // Keyboard navigation on/off
    performance             :   1,          // 0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
    image_protect           :   1,          // Disables image dragging and right click with Javascript

    // Size & Position                         
    min_width               :   0,          // Min width allowed (in pixels)
    min_height              :   0,          // Min height allowed (in pixels)
    vertical_center         :   1,          // Vertically center background
    horizontal_center       :   1,          // Horizontally center background
    fit_always              :   0,          // Image will never exceed browser width or height (Ignores min. dimensions)
    fit_portrait            :   0,          // Portrait images will not exceed browser height
    fit_landscape           :   0,          // Landscape images will not exceed browser width

    // Components                           
    slide_links             :   'blank',    // Individual links for each slide (Options: false, 'num', 'name', 'blank')
    thumb_links             :   1,          // Individual thumb links for each slide
    thumbnail_navigation    :   0,          // Thumbnail navigation
    slides                  :   home        // Using the home Image array we created

});

然后创建restSupersized函数:

function resetSupersized(arr)
{   

    $("#play-button").empty().remove();
    $("#thumb-list").empty().remove();
    $("#thumb-back").empty().remove();
    $("#thumb-forward").empty().remove();


    $("#supersized").fadeOut('fast', function() 
    {

        $('#supersized-loader').empty().remove();
        $('#supersized').empty().remove();
        $('#hzDownscaled').empty().remove();
        $('body').append('<div id="supersized-loader"></div><ul id="supersized"></ul>');


        // Animation complete.
        $("#tray-button").fadeIn();
        $('#thumb-tray').html('<div id="thumb-back"></div><div id="thumb-forward"></div>');

        $.supersized({
           // Functionality
           slideshow            :   1,          // Slideshow on/off
           autoplay             :   1,          // Slideshow starts playing automatically
           start_slide          :   1,          // Start slide (0 is random)
           stop_loop            :   0,          // Pauses slideshow on last slide
           random               :   0,          // Randomize slide order (Ignores start slide)
           slide_interval       :   3000,       // Length between transitions
           transition           :   1,          // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
           transition_speed     :   500,        // Speed of transition
           new_window           :   1,          // Image links open in new window/tab
           pause_hover          :   0,          // Pause slideshow on hover
           keyboard_nav         :   1,          // Keyboard navigation on/off
           performance          :   1,          // 0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
           image_protect        :   1,          // Disables image dragging and right click with Javascript

           // Size & Position                          
           min_width            :   0,          // Min width allowed (in pixels)
           min_height           :   0,          // Min height allowed (in pixels)
           vertical_center      :   1,          // Vertically center background
           horizontal_center    :   1,          // Horizontally center background
           fit_always           :   0,          // Image will never exceed browser width or height (Ignores min. dimensions)
           fit_portrait         :   0,          // Portrait images will not exceed browser height
           fit_landscape        :   0,          // Landscape images will not exceed browser width

           // Components                            
            slide_links         :   'blank',    // Individual links for each slide (Options: false, 'num', 'name', 'blank')
            thumb_links         :   1,          // Individual thumb links for each slide
            thumbnail_navigation:   0,          // Thumbnail navigation
            slides              :   arr

        });     



    });

}

然后使用我想要使用的数组调用该函数...即onClick();

resetSupersized(second);

感谢您的帮助; - )

1 个答案:

答案 0 :(得分:0)

不知道这个答案对你是否仍然有效。我正在为这两个寻找解决方案,如果你在加载画廊之前和之后调查你的html,它会变得非常简单。

这个图库的作用是在图片中添加<ul>元素...每次重新加载图库时,它都会添加更多图片而不是删除。

我想你的画廊第一次看起来还不错,当你淡出时,一定要清空你的画廊div,就像这样:

$('#supersized').html('');