简体   繁体   English

更改jQuery的超大插件的高度和宽度

[英]Change the height and width of the Supersized plugin for jquery

I am using the Supersized jquery plugin 3.2.7 to create a slider for a website. 我正在使用Supersized jquery插件3.2.7为网站创建一个滑块。 The instructions for Supersized set up a full screen implementation of the slider, but I want to actually make the slider about 70% of the current width. “超大尺寸”的说明设置了滑块的全屏实现,但是我实际上希望使滑块大约是当前宽度的70%。 According to the Supersized website, I should be able to fix this by changing the CSS selector for the slider so that the position is "absolute" instead of relative. 根据超大型网站,我应该能够通过更改滑块的CSS选择器来解决此问题,从而使位置是“绝对”而不是相对。 However, when I make that change--and shrink the height and width--the slider simply disappears. 但是,当我进行更改(并缩小高度和宽度)时,滑块就会消失。 I have tried using smaller pictures too, and that does not seem to fix the issue either. 我也尝试使用较小的图片,但这似乎也无法解决问题。 I was hoping someone might have an idea of what I am missing. 我希望有人可能对我的缺失有所了解。 The CSS and the HTML code are below. CSS和HTML代码如下。 Thanks. 谢谢。

CSS: CSS:

#home-slider {
position: relative;
overflow: hidden;
height: 100%;
width: 100%;
}

#home-slider .slider-text {
position: absolute;
left: 50%;
top: 70%;
margin: -10px 0 0 -585px;
width: 1170px;
height: 150px;
text-align: left;
z-index: 2; 
}
#home-slider .slide-content {
font-size: 60px;
color: #FFFFFF;
letter-spacing: -3px;
text-transform: uppercase;  
}
#home-slider .control-nav {
position: absolute;
width: 100%;
background: #2F3238;
height: 50px;
bottom: 0;
z-index: 2;
}

... ...

The HTML is: HTML是:

 <!-- Homepage Slider -->
 <div id="home-slider"> 
 <div class="overlay"></div>

 <div class="slider-text">
    <div id="slidecaption"></div>
 </div>   

<div class="control-nav">
    <a id="prevslide" class="load-item"><i class="font-icon-arrow-simple-left"></i></a>
    <a id="nextslide" class="load-item"><i class="font-icon-arrow-simple-right"></i></a>
    <ul id="slide-list"></ul>

    <a id="nextsection" href="#work"><i class="font-icon-arrow-simple-down"></i></a>
 </div>
 </div>

The Javascript is: Javascript是:

BRUSHED.slider = 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:  12000,     // Length between transitions
    transition:  1,         // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, . . .
    transition_speed:300,       // 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
    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:  1,         // Image will never exceed browser width
    fit_portrait:1,                 // 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'
    thumb_links: 0,         // Individual thumb links for each slide
    thumbnail_navigation: 0,    // Thumbnail navigation
    slides:           [     // Slideshow Images
                {image : '_include/img/slider-images/image01.jpg' . . . ''},
                    {image : '_include/img/slider-images/image02.jpg' . . . ''},
                {image : '_include/img/slider-images/image03.jpg',. . . ''},
                  ],

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

});

}

Ahh, I found the answer to this question. 啊,我找到了这个问题的答案。 They information on the superslider website was a bit incomplete. 他们在超级滑块网站上的信息有点不完整。

The first thing to do is change the supersized.css file. 首先要做的是更改supersized.css文件。 Change the #supersized and #supersized li position property from fixed -> absolute. 从固定->绝对更改#supersized和#supersized li位置属性。 The second thing to do--omitted in the instructions--is to change the height and or width properties in the #supersized and #supersized li properties to reflect your new desired height and width. 要做的第二件事-在说明中被省略-是更改#supersized和#supersized li属性的height和or width属性,以反映您所需的新高度和宽度。

This last part was a bit tricky, because it falls through the inheritance gap. 最后一部分有些棘手,因为它属于继承差距。 The property has to be set in the supersized.css. 该属性必须在supersized.css中设置。 In my case, changing the slider height and width properties in the site main.css--which was the bottom entry in my CSS link files, did not affect this property, as the framework did not directly address the #supersized id. 就我而言,更改站点main.css中的滑块高度和宽度属性(这是我的CSS链接文件的底部条目)不会影响此属性,因为框架没有直接处理#supersized id。 So, this works now :). 因此,这现在可以工作了:)。

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

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