图像库与覆盖和html内部不能覆盖正确的图像.jquery
Image Gallery with Overlay and html inside cant overlay correct image. jquery
嗨,我在做一个图库,你有拇指,每个选择主图像,如果你选中主图像,你应该得到一个覆盖,覆盖里面是图片和一些额外的html。
我几乎完成了90%的代码http://jsfiddle.net/s6TGs/5/
我只是使用jquerytools…问题是当你选择第二个拇指…你得到的叠加是thumb1的叠加。即使我改变各自的(rel="#target")。所以我猜我做了什么或者错过了什么。
请有人向我解释一下,为什么即使在相应的rel, is更改后,触发器总是为item1。
提前感谢。
下面是脚本
$(function() {
$(".scrollable").scrollable();
$(".items img").click(function() {
// see if same thumb is being clicked
if ($(this).hasClass("active")) { return; }
// calclulate large image's URL based on the thumbnail URL (flickr specific)
var url = $(this).attr("src").replace("_t", "");
var relo = $(this).attr("relo");
// get handle to element that wraps the image and make it semi-transparent
var wrap = $("#image_wrap").fadeTo("medium", 0.5);
// the large image from www.flickr.com
var img = new Image();
// call this function after it's loaded
img.onload = function() {
// make wrapper fully visible
wrap.fadeTo("fast", 1);
// change the image
wrap.find("img").attr("src", url);
wrap.find("img").attr("rel", relo);
};
// begin loading the image from www.flickr.com
img.src = url;
// activate item
$(".items img").removeClass("active");
$(this).addClass("active");
// when page loads simulate a "click" on the first image
}).filter(":first").click();
});
// This makes the image Overlay with a div and html
$(document).ready(function() {
$("img[rel]").overlay();
});
好吧,至少我终于把它搞定了。现在我只需要建立一个NEXT和PREV按钮。但我会尝试,直到我真的不能,然后我问…谢谢. .这里是代码,如果它适合某些人的需要。
<script>
$(function() {
$(".scrollable").scrollable();
$(".items img").click(function() {
// see if same thumb is being clicked
if ($(this).hasClass("active")) { return; }
// calclulate large image's URL based on the thumbnail URL (flickr specific)
var url = $(this).attr("src").replace("_t", "");
// get handle to element that wraps the image and make it semi-transparent
var wrap = $("#image_wrap").fadeTo("medium", 0.5);
var wrap2 = $("#mies1");
// the large image from www.flickr.com
var img = new Image();
// call this function after it's loaded
img.onload = function() {
// make wrapper fully visible
wrap.fadeTo("fast", 1);
// change the image
wrap.find("img").attr("src", url);
wrap2.find("img").attr("src", url);
};
// begin loading the image from www.flickr.com
img.src = url;
// activate item
$(".items img").removeClass("active");
$(this).addClass("active");
// when page loads simulate a "click" on the first image
}).filter(":first").click();
});
// This makes the image Overlay with a div and html
$(document).ready(function() {
$("img[rel]").overlay();
});
</script>
相关文章:
- 点击(右键点击)使用传单地图库获取图像覆盖的像素坐标
- 将谷歌地图中的平移边界设置为图像覆盖
- Javascript或PHP水印或将图像覆盖到图像上
- 如何在滚动/调整大小时保持背景图像覆盖屏幕
- 在 webGL 中用.jpg图像覆盖矩形
- JQUERY图像覆盖渐变in()在鼠标悬停时淡入淡出
- 谷歌地图:更新图像覆盖
- 无法使用图像覆盖添加bing主题
- 是否可以在传单中拉伸图像覆盖
- 推特引导程序,旋转木马上的图像覆盖
- 屏幕上的图像覆盖切换按钮
- 画布:理解globalCompositeOperation擦除部分图像覆盖
- 使用BringToFront()时图像覆盖状态丢失:传单
- 图像覆盖PHP生成的项目
- preserveAspectRatio模式图像在SVG中,如css背景图像覆盖
- 单击删除视频上的图像覆盖
- 鼠标悬停时,一个图像覆盖另一个图像
- Jquery图像覆盖
- JavaScript图像覆盖web应用程序
- 如何获得背景图像覆盖与100%的高度