jQuery讓div顯示在鼠標點擊位置


<form class="myForm" id="propertyForm">
    <div class="form_title">
        屬性設置
        <span id="close" style="float:right;">X</span>
    </div>
    <div class="form_content">
        <table>
            <tr>
                <td class="th">分支流量低限值:</td>
                <td><input type="text" style="width:120px" id="ele_min"/></td>
            </tr>
            <tr>
                <td class="th">分支流量高限值:</td>
                <td><input type="text" style="width:120px" id="ele_max"/></td>
            </tr>
            <tr>
                <td class="th">制程進度:</td>
                <td><input type="text" style="width:120px" id="ele_schedule"/></td>
            </tr>
            <tr>
                <td class="th">在制品標識類型:</td>
                <td>
                    <select id="ele_logoType">
                        <option value="0">在制品容器標識</option>
                        <option value="1">制品容器標識</option>
                    </select>
                </td>
            </tr>
        </table>
    </div>
    <div class="form_btn_div">
        <input type="reset" value="重置"/>
        <input type="button" value="確定" onclick="alert(demo.$focus)"/>
    </div>
</form>

  下面的是鼠標點擊事件中添加的代碼:

var div = $("#propertyForm");
                    if (div.is(":hidden")) {
                        div.show();
                        div.css("left", document.body.scrollLeft + event.clientX + 1);
                        div.css("top", document.body.scrollLeft + event.clientY + 10);
                    } else {
                        div.hide();
                    }

  


免責聲明!

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



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