十分需要帮助,用js写图片放大的效果,一个div对一个代码可以出来,但是多个div显示的是同一个图片的放大
代码如下:<scripttype="text/javascript">functionshowPreview(event){$("#featured-preview")....
代码如下:
<script type="text/javascript">
function showPreview(event) {
$("#featured-preview").show();
};
function hidePreview(event) {
$("#featured-preview").hide();
};
function movePreview(event) {
var content_position = $("#d1").offset();
};
$(document).ready(function() {
var overlay_wrap = $("#featured-overlay");
var overlay_els = $("div", overlay_wrap)
overlay_els
.css('opacity', 0)
.mousemove( movePreview )
.mouseenter(function() {
updatePreview( overlay_els.index( this ) );
})
.show();
overlay_wrap
.mouseenter( showPreview )
.mouseleave( hidePreview );
});
</script>
<script type="text/javascript">
function showPreview(event) {
$("#featured1-preview").show();
};
function hidePreview(event) {
$("#featured1-preview").hide();
};
function movePreview(event) {
var content_position = $("#d2").offset();
};
$(document).ready(function() {
var overlay_wrap = $("#featured1-overlay");
var overlay_els = $("div", overlay_wrap)
overlay_els
.css('opacity', 0)
.mousemove( movePreview )
.mouseenter(function() {
updatePreview( overlay_els.index( this ) );
})
.show();
overlay_wrap
.mouseenter( showPreview )
.mouseleave( hidePreview );
});
</script>
<script type="text/javascript">
function showPreview(event) {
$("#featured-preview2").show();
};
function hidePreview(event) {
$("#featured-preview2").hide();
};
function movePreview(event) {
var content_position = $("#d3").offset();
};
$(document).ready(function() {
var overlay_wrap = $("#featured-overlay2");
var overlay_els = $("div", overlay_wrap)
overlay_els
.css('opacity', 0)
.mousemove( movePreview )
.mouseenter(function() {
updatePreview( overlay_els.index( this ) );
})
.show();
overlay_wrap
.mouseenter( showPreview )
.mouseleave( hidePreview );
});
</script
body 部分
<div id="featured-preview"><img alt="你是我无法斑驳的时光" src="1.jpg" width="400" height="200"/></div>
<div id="featured-overlay"><div></div>
</div>
<div id="featured1-preview"><img alt="关于友情" src="2.jpg" width="400" height="200"/></div>
<div id="featured1-overlay"><div></div>
</div>
<div id="featured-preview2"><img alt="女孩子,刚刚好就好" src="3.jpg" width="400" height="200"/></div>
<div id="featured-overlay2"><div></div>
</div> 展开
<script type="text/javascript">
function showPreview(event) {
$("#featured-preview").show();
};
function hidePreview(event) {
$("#featured-preview").hide();
};
function movePreview(event) {
var content_position = $("#d1").offset();
};
$(document).ready(function() {
var overlay_wrap = $("#featured-overlay");
var overlay_els = $("div", overlay_wrap)
overlay_els
.css('opacity', 0)
.mousemove( movePreview )
.mouseenter(function() {
updatePreview( overlay_els.index( this ) );
})
.show();
overlay_wrap
.mouseenter( showPreview )
.mouseleave( hidePreview );
});
</script>
<script type="text/javascript">
function showPreview(event) {
$("#featured1-preview").show();
};
function hidePreview(event) {
$("#featured1-preview").hide();
};
function movePreview(event) {
var content_position = $("#d2").offset();
};
$(document).ready(function() {
var overlay_wrap = $("#featured1-overlay");
var overlay_els = $("div", overlay_wrap)
overlay_els
.css('opacity', 0)
.mousemove( movePreview )
.mouseenter(function() {
updatePreview( overlay_els.index( this ) );
})
.show();
overlay_wrap
.mouseenter( showPreview )
.mouseleave( hidePreview );
});
</script>
<script type="text/javascript">
function showPreview(event) {
$("#featured-preview2").show();
};
function hidePreview(event) {
$("#featured-preview2").hide();
};
function movePreview(event) {
var content_position = $("#d3").offset();
};
$(document).ready(function() {
var overlay_wrap = $("#featured-overlay2");
var overlay_els = $("div", overlay_wrap)
overlay_els
.css('opacity', 0)
.mousemove( movePreview )
.mouseenter(function() {
updatePreview( overlay_els.index( this ) );
})
.show();
overlay_wrap
.mouseenter( showPreview )
.mouseleave( hidePreview );
});
</script
body 部分
<div id="featured-preview"><img alt="你是我无法斑驳的时光" src="1.jpg" width="400" height="200"/></div>
<div id="featured-overlay"><div></div>
</div>
<div id="featured1-preview"><img alt="关于友情" src="2.jpg" width="400" height="200"/></div>
<div id="featured1-overlay"><div></div>
</div>
<div id="featured-preview2"><img alt="女孩子,刚刚好就好" src="3.jpg" width="400" height="200"/></div>
<div id="featured-overlay2"><div></div>
</div> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询