我正在使用Supersized jquery插件3.2.7为网站创建一个滑块。 Supersized的说明设置了滑块的全屏实现,但我想实际上使滑块大约为当前宽度的70%。根据Supersized网站,我应该能够通过更改滑块的CSS选择器来解决这个问题,以便位置是“绝对的”而不是相对的。然而,当我做出改变 - 并缩小高度和宽度 - 滑块就会消失。我也试过使用较小的图片,这似乎也无法解决问题。我希望有人可能知道我错过了什么。 CSS和HTML代码如下。感谢。
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;
}
...
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>
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
});
}
答案 0 :(得分:0)
要做的第一件事是更改supersized.css文件。将#supersized和#supersized li位置属性从fixed更改 - &gt;绝对。要做的第二件事 - 在说明中省略 - 是更改#supersized和#supersized li属性中的高度和/或宽度属性,以反映新的所需高度和宽度。
这最后一部分有点棘手,因为它落后于继承差距。该属性必须在supersized.css中设置。在我的例子中,更改站点main.css中的滑块高度和宽度属性 - 这是我的CSS链接文件中的底部条目,不会影响此属性,因为框架没有直接解决#supersized id。所以,这现在有效:)。