繁体   English   中英

从外部页面链接到具有Supersized的特定幻灯片

[英]link from external page to a specific slide with Supersized

无论如何,是否可以从我网站的另一页面链接到超大画廊中的特定图像。 我有一个主页,其中包含与超大图库中的图像相对应的多个缩略图。 有没有一种方法可以链接每个缩略图,以便当它转到超大页面时位于正确的幻灯片上?

这就是我在超大页面中使用脚本的方式

  <script type="text/javascript">

        jQuery(function($){

            $.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              :   6,          // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
                transition_speed        :   1000,       // 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            :   1,          // Portrait images will not exceed browser height
                fit_landscape           :   0,          // Landscape images will not exceed browser width

                // Components                           
                slide_links             :   'name', // 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                  :   [           // Slideshow Images
                {image : 'images/4change.jpg', title : 'slide-link-01', thumb : '', url : '' },
                {image : 'images/a1.jpg', title : 'slide-link-02', thumb : '', url : '' },
                {image : 'images/amplifon1.jpg', title : 'slide-link-03', thumb : '', url : '' },
                {image : 'images/amplifon2.jpg', title : 'slide-link-04', thumb : '', url : '' },
                {image : 'images/brain1.jpg', title : 'slide-link-05', thumb : '', url : '' },
                {image : 'images/brain2.jpg', title : 'slide-link-06', thumb : '', url : '' },
                {image : 'images/britishhandball.jpg', title : 'slide-link-07', thumb : '', url : '' },
                {image : 'images/britishhandball2.jpg', title : 'slide-link-08', thumb : '', url : '' },
                {image : 'images/cord.jpg', title : 'slide-link-09', thumb : '', url : '' },
                {image : 'images/crossborder1.jpg', title : 'slide-link-10', thumb : '', url : '' },
                {image : 'images/crossborder2.jpg', title : 'slide-link-11', thumb : '', url : '' },
                {image : 'images/guiness1.jpg', title : 'slide-link-12', thumb : '', url : '' },
                {image : 'images/guiness2.jpg', title : 'slide-link-13', thumb : '', url : '' },
                {image : 'images/harambee.jpg', title : 'slide-link-14', thumb : '', url : '' },
                {image : 'images/lifetracks.jpg', title : 'slide-link-15', thumb : '', url : '' },
                {image : 'images/missimo.jpg', title : 'slide-link-16', thumb : '', url : '' },
                {image : 'images/staffordshire.jpg', title : 'slide-link-17', thumb : '', url : '' },
                                             ],

                // Theme Options               
                progress_bar            :   1,
                // Timer for each slide                         
                mouse_scrub             :   0

            });
        });


 </script>

如何链接另一个页面的图像?

要动态添加图像,请使用api.options.slides数组和api._build() ;

例如:

api.options
      .slides.push({image: "http://placehold.it/350x150",title: "TEST"});
api._build();

请注意,此插件对我来说不太好,因为它会在全局范围内产生干扰。

要转到特定图像,可以使用api.goTo(); 方法。 要从另一个页面链接,可以使用hashlink:

在其他页面上:

<a href="/galery.html#im=15">

init超大之后:

api.goTo(document.location
                   .hash
                    .replace(/^#/,'')
                     .replace(/im=([0-9]+).*$/,'$1'))

或者如果您需要在启动时使用start_slide选项:

$.supersized({
            // ..... options 
            start_slide : document.location
                                    .hash
                                     .replace(/^#/,'')
                                      .replace(/im=([0-9]+).*$/,'$1')),  
            // ..... options 
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM