2014-06-05 60 views
0

上粘貼文本菜單在我申請的div一個已經滾動property.Inside div,我模板table超過100 rows.user可以contextMenu如何特定元素

contextMenu添加/刪除行有4個選項名稱AddTop,AddBottom,Delete and Edit。事情就在這裏如果用戶用鼠標右鍵點擊任何rowcontextMenu應該堅持那row甚至如果用戶滾動表格。立即就沒有發生。

我爲contextMenu編寫了以下代碼。

<div id="contextMenu" class="dropdown clearfix"> 
      <ul class="dropdown-menu-r" role="menu" aria-labelledby="dropdownMenu"> 
       <li id="addTop"><a tabindex="-1" href="#"> <span class="new-icons new-icons-add-top"></span> Add Top</a></li> 
       <li id="addBottom"><a tabindex="-1" href="#"> <span class="new-icons new-icons-add-bottom"></span> Add Bottom</a></li> 
       <li id="delete"><a tabindex="-1" href="#"><span class="new-icons new-icons-delete"></span> Delete</a></li> 
       <li id="edit"><a tabindex="-1" href="#"><span class="new-icons new-icons-edit2"></span> Edit</a></li> 
      </ul> 
     </div> 

一旦上了table。繼功能的任一行用戶右擊運行。

var domEle=document.getElementById("contextMenu"), 
    xPosition=event.pageX, 
    yPosition=event.pageY; 
domEle.style.display="block"; 
domEle.style.left=xPosition+"px"; 
domEle.style.top=yPosition+"px"; 

以下功能完成後,contextMenu來,直到它的罰款。問題是如果我滾動contextMenu沒有堅持到特定位置。

我希望你們明白我想說明的是什麼。

任何人都可以幫助我。

謝謝。

回答