0

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

  1. 我有5组图片,一组2张。
  2. 页面加载时,随机播放一组然后停止。

基本上,我想在每次页面重新加载时选择不同的幻灯片集。

感谢您的任何帮助。

4

1 回答 1

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;
}
于 2013-10-08T05:05:22.283 回答