English 中文(简体)
将元素拖曳到 JavaScript 时, 将元素强制到 : 与 JavaScript 拖曳元素到 : hover 。 no jQuery
原标题:Forcing an element to :hover with JavaScript when dragging an element over it. No jQuery

我在这里找到了一些搜索结果 但这些结果都是为了jQuery 我所看的夫妇 并不适用于我的案子

这是一个小项目,我至今避免使用jQuery。我想保持这样,不要需要图书馆。

基本上, I m 拖曳 lt; article> 元素到 lt; div> 元素。 div 有封闭垃圾桶的 背景图像 。 在 CSS 中, 当 < code>: hover 被触发时, 它会设置为显示相同的垃圾桶, 但会打开垃圾桶 。

Now, when I pull my article element to the div, the :hover effect isn t being triggered. How do I do this?

所有要求的元素都设置了 < code> draggable , 并添加了所需的事件听众, Console.log 确认它们有效 。

最佳回答

您可以定义名为打开的 CSS 类, 名为 opopop_ trash, 并设置打开的垃圾回收桶的背景图像, 然后您就可以使用 javascript 来更改拖动元素的类 。

document.getElementById("draggedItem").className = "open_trash";

您可以将类名设置为空字符串或其他正在停用的东西。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签