<div style="position:relative;"> <asp:Image ID="myImg" runat="server" Width="670px" /> <span style="position:relative;display:none; background:wheat;border:1px solid gray;padding:3px;overflow:hidden;" id="NotificationMsg">滚动鼠标中键,可以放大或者缩小图片</span> </div>
<script type="text/javascript">
$(document).ready(function() {
var count = 0;
$("#ctl00_ContentPlaceHolder1_myImg").hover(function(e) {
var left = e.originalEvent.x || e.originalEvent.layerX || 0; //get the left position
var top = e.originalEvent.y || e.originalEvent.layerY || 0; //get the top position
$("#NotificationMsg").css({ 'position': 'absolute', 'left': left, 'top': top });
$("#NotificationMsg").css("display", "block");
}, function() {
//alert('mouserout');
$("#NotificationMsg").css("display", "none");
}).mousewheel(function(event, delta, deltaX, deltaY) {
count++;
var height = $(this).attr("height"); //get initial height
var width = $(this).attr("width"); // get initial width
var stepex = height / width; //get the percentange of height / width
var minHeight = 150; // min height
var tempStep = 50; // evey step for scroll down or up
$(this).removeAttr('style');
if (delta == 1) { //up
$(this).attr("height", height + count * tempStep);
$(this).attr("width", width + count * tempStep / stepex);
}
else if (delta == -1) { //down
if (height > minHeight)
$(this).attr("height", height - count * tempStep);
else
$(this).attr("height", tempStep);
if (width > minHeight / stepex)
$(this).attr("width", width - count * tempStep / stepex);
else
$(this).attr("width", tempStep / stepex);
}
event.preventDefault();
count = 0;
});
});
</script>
var left = e.originalEvent.x || e.originalEvent.layerX || 0; //get the left position var top = e.originalEvent.y || e.originalEvent.layerY || 0; //get the top position
var height = $(this).attr("height"); //get initial height
var width = $(this).attr("width"); // get initial width
var stepex = height / width; //get the percentange of height / width
var minHeight = 150; // min height
var tempStep = 50; // every step for scrolling down or up
$(this).removeAttr('style');
if (delta == 1) { //up
$(this).attr("height", height + count * tempStep);
$(this).attr("width", width + count * tempStep / stepex);
}
else if (delta == -1) { //down
if (height > minHeight)
$(this).attr("height", height - count * tempStep);
else
$(this).attr("height", tempStep);
if (width > minHeight / stepex)
$(this).attr("width", width - count * tempStep / stepex);
else
$(this).attr("width", tempStep / stepex);
}
event.preventDefault();
count = 0;
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有