[英]responsive div based on image actual width
I just brought a jquery slider control and it said it was responsive, but in the demo's it's responsive I just can't figure out how or what makes it responsive and I copied there code and it just sits in my page at a fixed width. 我刚刚带来了一个jquery滑块控件,它说它是响应式的,但是在演示版中它是响应式的,我只是无法弄清楚它是如何响应的,或者是什么使它响应式的,所以我在那儿复制了代码,它只是以固定的宽度位于我的页面中。
So my only solution I know that could remedy this problem is get the parent element width of the #seven_container and use that as a guide on window.resize and change the properties of width and height for the control eg .seven_container might need another parent div to add and remove the content 因此,我唯一可以解决此问题的解决方案是获取#seven_container的父元素宽度并将其用作window.resize的值,并更改控件的width和height属性,例如.seven_container可能需要另一个父div添加和删除内容
var tb=$(".seven_container").superseven({
width:723,
height:425
});
Does anyone know how to use actual width of an image and calculate aspect ratio of the $('.seven_container') parent 有谁知道如何使用图像的实际宽度并计算$('。seven_container')父级的长宽比
They jquery is as follows 他们jquery如下
var tb=$(".seven_container").superseven({
width:723,
height:425,
autoplay:true,
interval:5,
fullwidth:false,
responsive:true,
progressbar:true,
swipe:true,
keyboard:false,
scrollmode:false,
animation:0,
navtype:0,
repeat_mode:true,
skin:'default',
lightbox:true,
pause_on_hover:true
});
and here is the markup 这是标记
<div class="seven_container">
<div id="seven_viewport">
<div class="seven_slider">
<div class="seven_slide" image-src="images/vivo_slider/make_me_over_package.png"></div>
<div class="seven_slide" image-src="images/vivo_slider/regrowth_color_package.png"></div>
<div class="seven_slide" image-src="images/vivo_slider/global_color_package.png"></div>
<div class="seven_slide" image-src="images/vivo_slider/half_head_foils_package.png"></div>
<div class="seven_slide" image-src="images/vivo_slider/balayage_color_package.png"></div>
<div class="seven_slide" image-src="images/vivo_slider/highlights_color_package.png"></div>
<div class="seven_slide" image-src="images/vivo_slider/full_heads_foil_package.png"></div>
<div class="seven_slide" image-src="images/vivo_slider/new_client_hair_offer_package.png"></div>
</div>
</div>
<a id="left_btn" class="seven_nav">Previous Slide</a>
<a id="right_btn" class="seven_nav right_btn">Next Slide</a>
</div>
Simply as a test. 只是作为测试。 Try using this Javascript instead. 尝试改用此Javascript。
$(document).ready(function(){
var tb=$(".seven_container").superseven({
width:774,
height:436,
caption_animation: 2,
fullwidth:true,
animation:0,
autoplay:true,
interval:3,
progressbar:true,
progressbartype:"linear",
bullet:true,
thumbnail:false,
repeat_mode:true,
responsive:true,
swipe:true,
keyboard:true,
skin:"clean",
lightbox:true
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.