久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Firefox 中的 Html5 拖放鼠標位置

Html5 Drag and Drop Mouse Position in Firefox(Firefox 中的 Html5 拖放鼠標位置)
本文介紹了Firefox 中的 Html5 拖放鼠標位置的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我有一個使用拖放的 HTML5 應用程序.本質上,用戶可以將圖像從抽屜"拖到畫布上以創建更大的圖像.我希望元素落在它們被釋放的地方.我可以在除 Firefox 之外的所有瀏覽器中使用此功能.

I have an HTML5 application which utilizes drag and drop. Essentially the user can drag an image from a "drawer" onto a canvas to create a larger image. I want the elements to drop in the place where they were release. I have this working in all browsers except Firefox.

drop 事件中,我使用下面的方法來獲取鼠標的坐標,并計算被放置的圖像在畫布中的位置.

On the drop event, I am using the following to get the coordinates of the mouse, and calculate the position of the dropped image within the canvas.

var top = evt.originalEvent.offsetX;
var left = evt.originalEvent.offsetY;

問題是,該屬性在 FF 中不可用.有沒有其他方法可以得到這個?沒有它,我看不到如何在 FF 中拖動和移動元素.

The issue is, this property is not available in FF. Is there any other way to get this? Without it, I can't see how to possible drag and move elements within FF.

注意:我沒有使用 canvas 元素.我正在將圖像放到一個 div 中.不確定這是否重要.

Note: I am not using the canvas element. I am dropping images to a div. Not sure if that matters.

推薦答案

在firefox中試試這個..

Try this in firefox..

var X = event.layerX - $(event.target).position().left;
var Y = event.layerY - $(event.target).position().top;

這篇關于Firefox 中的 Html5 拖放鼠標位置的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I get my jasmine tests fixtures to load before the javascript considers the document to be quot;readyquot;?(在 javascript 認為文檔“準備好之前,如何讓我的 jasmine 測試裝置加載?) - IT屋-程序員軟件開發技術
What do jasmine runs and waitsFor actually do?(jasmine 運行和等待實際上是做什么的?)
How to provide mock files to change event of lt;input type=#39;file#39;gt; for unit testing(如何提供模擬文件來更改 lt;input type=filegt; 的事件用于單元測試)
How to unit test a chained method using Jasmine(如何使用 Jasmine 對鏈式方法進行單元測試)
How do I inject $rootScope into an AngularJS unit test?(如何將 $rootScope 注入 AngularJS 單元測試?)
Jasmine - How to spy on a function call within a function?(Jasmine - 如何監視函數中的函數調用?)
主站蜘蛛池模板: 亚洲欧洲成人在线 | 瑞克和莫蒂第五季在线观看 | 91精品一区| 一级毛片免费完整视频 | 亚洲www啪成人一区二区麻豆 | 亚洲性人人天天夜夜摸 | 日韩欧美一二三区 | av影音在线 | 99精品九九| 一区二区三区在线 | 曰批视频在线观看 | 欧美一区二区大片 | 亚洲国产高清在线 | 一区二区在线不卡 | 一级毛片黄片 | 国产电影一区 | 白浆在线 | 国产高清在线 | 午夜激情影院 | 国产精品久久久久一区二区三区 | 久草视频在线播放 | 国产一区二区三区www | 久久久久久网站 | 99精品观看| 国产高清精品网站 | 国产精品国产三级国产aⅴ无密码 | 欧美精品在线播放 | 欧美日本久久 | 欧美午夜精品 | 久久久久久国产精品久久 | 日韩视频精品 | 久草综合在线视频 | 午夜精品久久久久久不卡欧美一级 | 视频三区| 999视频 | 香蕉久久av | 精品久久香蕉国产线看观看亚洲 | 欧美日韩免费在线 | 免费精品 | 日韩av免费在线电影 | 天天人人精品 |