大佬教程收集整理的这篇文章主要介绍了调整两个 iframe 的大小会失去对鼠标拖动的关注,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有两个水平的 iframe(一个在另一个上方)。 当我手动调整顶部 iframe 的大小时,其他 iframe 也会相应地调整大小。
但是当我向下拖动鼠标时,它也不起作用。只有当我拖得很慢时它才有效。不知何故,它失去了对底部 iframe 的关注。我已将底部 iframe 缩小,以查看当我将鼠标拖动到其 div 上时效果很好。
如何让鼠标上下拖动一样?
试试:http://jsfiddle.net/ngjp0o1L/
头部
<script type="text/JavaScript" src="http://code.jquery.com/jquery-1.9.1.Js"></script>
<script type="text/JavaScript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.Js"></script>
<link rel="stylesheet" type="text/CSS" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.CSS">
<style>
#parent {
position: absolute;
height: 90%;
margin: 0;
padding: 0;
wIDth: 95%;
}
#div1 {
position: relative;
height: 50%;
BACkground-color: yellow;
margin-bottom: 10px;
}
#div2 {
position: relative;
height: 50%;
BACkground-color: green;
z-index: 4;
}
</style>
身体
<div ID="parent">
<div ID="div1"> <iframe ID="iframe1" src="http://www.example.com/" style="wIDth:100%; height:100%;"></iframe> </div>
<div ID="div2"> <iframe ID="iframe2" src="http://www.example.com/" style="wIDth:80%; height:100%;"></iframe> </div>
</div>
<script>
$("#div1").resizable({
start: function (event,ui) {
ui.element.append($("<div/>",{
ID: "iframe-barrIEr",CSS: {
position: "absolute",top: 0,right: 0,bottom: 0,left: 0,"z-index": 10
}
}));
},stop: function (event,ui) {
$("#iframe-barrIEr",ui.element).remove();
},resize: function (event,ui) {
$("iframe",ui.element).wIDth(ui.size.wIDth).height(ui.size.height);
}
});
$('#div1').resize(function () {
$('#div2').height($("#parent").height() - $("#div1").height());
});
</script>
我解决了! 附加的 DIV 仅涵盖顶部 iframe/div。 我把它做得更大以覆盖底部 iframe/div,它不再失去焦点。
以上是大佬教程为你收集整理的调整两个 iframe 的大小会失去对鼠标拖动的关注全部内容,希望文章能够帮你解决调整两个 iframe 的大小会失去对鼠标拖动的关注所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。