jQuery/CSS:Div 继承动态调整大小图像的宽度
我有一个可以动态调整大小的图像。
该图像是图库的一部分,因此在右上角/右上角,我有缩略图来查看该图库中的图像。
拇指和图像都包含在类 .slider
的 div 中。
.slider
div 始终拉伸到浏览器的宽度,并且拇指相对于 .slider
定位。
如果我能让 .slider
div 始终反映图像的宽度,那就完美了,因为这样拇指将始终与图像右侧齐平(而不是像浏览器窗口那样)现在)。
请记住,图像可以在垂直和水平方向上动态调整大小,因此我必须去除图像的宽度和高度。
这是实际示例的链接:http://peteryang.com/v02/image/tylenol/
I have an image that is dynamically resizable.
The image is part of a gallery, so on the top/right corner, I have thumbnails to view images in that gallery.
Both the thumbs and image are contained within a div with class .slider
.
The .slider
div always stretches to width of browser, and the thumbs are positioned relative to the .slider
.
If I can get the .slider
div to always reflect the width of the image, it would be perfect, because then the thumbs would always flush right with the image (instead of the browser window, as it does now).
Remember the image is dynamically resizable vertically and horizontally, so I had to strip the image width and height.
Here is link of actual sample: http://peteryang.com/v02/image/tylenol/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 jQuery 在图像加载或显示或调整大小上附加一个事件(只需 google 即可),并在事件处理程序中找到图像的宽度和高度,并设置父 div 的宽度和高度
Attach an event on the image load or show or resize using jQuery (just google it) and in the event handler find the width and height of the image and set the width and height of your parent div