Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/407.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 图像预览溢出浏览器高度_Javascript_Jquery_Css - Fatal编程技术网

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不起作用,我的意思是底部的那一个间歇性地显示出来。当显示出来时,它仍然溢出屏幕底部。你能举个例子吗?比如小提琴或链接?