【工作記錄-前端】動態設置easyUI window位置


根據鼠標位置,動態設置easyui 新打開的window位置

動態設置easyUI  window位置。
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Basic Panel - jQuery EasyUI Demo</title>
    <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../demo.css">
    <script type="text/javascript" src="../../jquery.min.js"></script>
    <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
	<div id="target" class="easyui-window" title="title" closed="true" resizable="false"
		collapsible="false" minimizable="false" maximizable="false" style="width:500px;height:450px; display: none; ">  
      
    </div>
	<button type="button" onclick = "openWindow()">打開窗口</button>

	<script>
		var openWindow = function(){
			 var e = event || window.event;
			 var x = e.clientX;
			 var y =  $(document).scrollTop() + 50 ;
			 $('#target').window({
				 left: x + "px",
				 top: y + "px"
			 });
			 $('#target').window('open');
		}
	</script>
</body>
</html>

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM