超大 - 选择不同的幻灯片组

时间:2013-10-07 05:03:33

标签: javascript jquery supersized

我为我的网站使用Supersized插件,想知道是否可以执行以下操作:

  1. 我有5套图片,2套图片。
  2. 当页面加载时,播放一组RANDOMLY,然后停止。
  3. 基本上,我想超级化每次页面重新加载时选择不同的幻灯片组。

    感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

我自己想通了:

    var setnum;
setnum = Math.floor((Math.random()*5)+1);
switch (setnum)
{
case 1:
jQuery(function($){ 
    $.supersized({
    // Functionality
        slide_interval          :   5000,       // Length between transitions
        transition              :   1,          // 0one, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
        transition_speed        :   3000,       // Speed of transition
        stop_loop               :   1,          //Pauses slideshow upon reaching the last slide.
    // Components                           
    slide_links             :   'blank',    // Individual links for each slide (Options: false, 'num', 'name', 'blank')
    slides                  :   [           // Slideshow Images
        {image : 'image1.jpg'},
        {image : 'image1-2.jpg'},
                                ]

            });
    });
  break;
case 2:
jQuery(function($){ 
    $.supersized({
    // Functionality
        slide_interval          :   5000,       // Length between transitions
        transition              :   1,          // 0one, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
        transition_speed        :   3000,       // Speed of transition
        stop_loop               :   1,          //Pauses slideshow upon reaching the last slide.
    // Components                           
    slide_links             :   'blank',    // Individual links for each slide (Options: false, 'num', 'name', 'blank')
    slides                  :   [           // Slideshow Images
        {image : 'image2.jpg'},
        {image : 'image2-2.jpg'},
                                ]

            });
    });
  break;
case 3:
jQuery(function($){ 
    $.supersized({
    // Functionality
        slide_interval          :   5000,       // Length between transitions
        transition              :   1,          // 0one, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
        transition_speed        :   3000,       // Speed of transition
        stop_loop               :   1,          //Pauses slideshow upon reaching the last slide.
    // Components                           
    slide_links             :   'blank',    // Individual links for each slide (Options: false, 'num', 'name', 'blank')
    slides                  :   [           // Slideshow Images
        {image : 'image3.jpg'},
        {image : 'image3-2.jpg'},
                                ]

            });
    });
  break;
case 4:
jQuery(function($){ 
    $.supersized({
    // Functionality
        slide_interval          :   5000,       // Length between transitions
        transition              :   1,          // 0one, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
        transition_speed        :   3000,       // Speed of transition
        stop_loop               :   1,          //Pauses slideshow upon reaching the last slide.
    // Components                           
    slide_links             :   'blank',    // Individual links for each slide (Options: false, 'num', 'name', 'blank')
    slides                  :   [           // Slideshow Images
        {image : 'image4.jpg'},
        {image : 'image4-2.jpg'},
                                ]

            });
    });
  break;
case 5:
jQuery(function($){ 
    $.supersized({
    // Functionality
        slide_interval          :   5000,       // Length between transitions
        transition              :   1,          // 0one, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
        transition_speed        :   3000,       // Speed of transition
        stop_loop               :   1,          //Pauses slideshow upon reaching the last slide.
    // Components                           
    slide_links             :   'blank',    // Individual links for each slide (Options: false, 'num', 'name', 'blank')
    slides                  :   [           // Slideshow Images
        {image : 'image5.jpg'},
        {image : 'image5-2.jpg'},
                                ]

            });
    });
  break;
}