简体   繁体   English

Orbit Jquery插件将宽度扩展到没有链接的内容大小

[英]Orbit Jquery Plugin expand width to size of content without link

I am using the Orbit Jquery Plugin from the ZURB Foundation and I was wondering if there was a way to auto-detect the width without having to include an a href="" link. 我正在使用来自ZURB Foundation的Orbit Jquery插件,我想知道是否有一种方法可以自动检测宽度而不必包含a href=""链接。 As far as I can tell, the plugin detects the width from the a element and calculates width and height based on this. 据我所知,该插件从a元素检测宽度,并据此计算宽度和高度。 Is there a way to detect width and height without having to use an a element? 有没有一种方法可以检测宽度和高度而无需使用元素?

I put the code up on jsfiddle, though it is hardly functional there. 我将代码放在jsfiddle上,尽管在那里几乎不起作用。

http://jsfiddle.net/jhoffm34/36vqb/1/ http://jsfiddle.net/jhoffm34/36vqb/1/

I'm still new to this, but wondering if there is a simple way to achieve this. 我对此还很陌生,但是想知道是否有一种简单的方法可以实现这一目标。

in jQuery, you can detect the width with .width() 在jQuery中,您可以使用.width()检测宽度

 var ratio=1/5; // 
 var height=$('img:first','#sliderfeatured').width()*ratio; // grab the first img width
 // or var height = $('img:first', '#sliderfeatured').attr('width')*ratio;

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

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