Javascript 图像预览溢出浏览器高度
使用图像预览插件,我需要预览自动上升时,缩略图几乎是底部的屏幕。我试过这个代码,但效果不好Javascript 图像预览溢出浏览器高度,javascript,jquery,css,Javascript,Jquery,Css,使用图像预览插件,我需要预览自动上升时,缩略图几乎是底部的屏幕。我试过这个代码,但效果不好 if((e.pageX <= $(document).width()/2) && (e.pageY <= $(document).height()*0.75)) { $("#preview") .css("top",(e.pageY - xOffset) + "px") .css("left",(e.pageX + yOffset) +
if((e.pageX <= $(document).width()/2) && (e.pageY <= $(document).height()*0.75)) {
$("#preview")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
} else if((e.pageX > $(document).width()/2) && (e.pageY <= $(document).height()*0.75)) {
$("#preview")
.css("top",(e.pageY - xOffset) + "px")
.css("right",($(document).width() - e.pageX + yOffset) + "px");
} else if((e.pageX <= $(document).width()/2) && (e.pageY > $(document).height()*0.75)) {
.css("bottom",($(window).height() - e.pageY + xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
} else {
$("#preview")
.css("bottom",($(window).height() - e.pageY + xOffset) + "px")
.css("right",($(document).width() - e.pageX + yOffset) + "px");
}
如果((e.pageX工作不好?你是什么意思?你缺少$(“#预览”)
在你的秒否则如果
?抱歉,在这里编辑它时它被删除了。By不起作用,我的意思是底部的那一个间歇性地显示出来。当显示出来时,它仍然溢出屏幕底部。你能举个例子吗?比如小提琴或链接?