- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在处理以下格式的 html:
<a href = xxx>
<div> div1 </div>
<div> div2 </div>
</a>
当我将鼠标放在第一个 div 上时,鼠标悬停事件的目标是该 div,但是当我拖动该 div 时,目标成为整个标签。有没有办法将拖动目标设置为 div 而不是整个链接?
最佳答案
您的 HTML 似乎无效
REF: HTML 5 states that the element "may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links)".
REF: Is putting a div inside an anchor ever correct?
将 draggable="true"
添加到元素(HTML5 功能)
draggable
The draggable global attribute is an enumerated attribute that indicates whether the element can be dragged, using the HTML Drag and Drop API. It can have the following values:
true, which indicates the element may be dragged
false, which indicates the element may not be dragged.
REF: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/draggable
<a href="">
<div draggable="true"> div1 </div>
</a>
<a href="">
<div draggable="true"> div2 </div>
</a>
关于javascript - mouseover 和 Dragstart 有不同的目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44575825/
是否有 JavaScript 或 jQuery 解决方案可以在鼠标悬停在 DOM 对象上时重复运行函数(在 setTimeout 之后)?否则说,是否有 JavaScript“鼠标悬停时执行”(或“如
它确实适用于 Linux+KDE,但不适用于 Windows/OSX/Linux + XFCE。 我有一个 ListView ,项目是自定义小部件,如果鼠标悬停在元素上,则 ListView 项目的委
显然我在做一些愚蠢的事情。 processTextNodes: function processTextNodes(node) { node = node || content.doc
我希望用户将鼠标悬停在对撞机(只是一个透明矩形)上超过 2 或 3 秒时能够看到描述菜单。我目前正在使用 javaFX 扩展。 我将程序设置为每当我将鼠标悬停在对撞机上时,它都会播放声音效果,但我希望
每次悬停输入框时,我都试图让图标更改颜色。问题是它只在悬停第一个输入文本框时改变背景,而不是其他两个。 我正在尝试在没有 jquery 的情况下获得这种效果。在此先感谢您的帮助! var input
嗨,我正在尝试将一系列鼠标悬停事件分组为一个,但我对 javascript 非常陌生,并且感到非常困惑。我有 5 个按钮,如下所示,我想创建一个函数来包含所有这些按钮。我将 div 的类用于此处未包含
可以在此处显示版本。我希望现有文本淡出,新文本淡入。出于某种原因,它会奇怪地淡入两次。 $(window).load(function(){ var originalTitle = $('.Pinct
我有以下代码,显示一个下拉框,该下拉框淡出然后被删除: $('.containerDIV').show().fadeOut(10000, function() {$(this).remove();})
HTML I'm div-1 I'm div-2 JS $("#div-1").bind('mouseover',function(event){ $('#div-2').stop(true,tr
我正在生成这样的图表 map : http://chart.apis.google.com/chart?chs=440x220&cht=t&chco=CBD122&chld=US&chd=s:_&ch
我很好奇为什么蓝色当我将鼠标从标题上移开时消失,而不是仅当鼠标离开整个时才消失 . $("#yw1 .portlet-title").mouseover(function(){ $("#yw
我处于这样一种情况,我需要在元素(在本例中为图像)在鼠标下方移动时触发 jQuery 的 mouseover 事件,因此与常见情况不同的是元素正在移动,而不是鼠标。 你知道有什么图书馆/要点/技术可以
我有这样的ajax请求片段: Comments --> Post Your Comme
每个文本都属于一个特定的图像,因此当有人将光标移到该图像上时。文本应该显示,当光标移出鼠标时,文本应该隐藏。不需要 jQuerty,必须是纯 JavaScript。任何人都知道我应该如何解决这个问题。
我有一个网络应用程序,每次单击时都会创建一个点(见下文)。当我将鼠标悬停在一堆点上时,我希望光标下的每个点都会触发 mouseover 或 mouseenter 事件。但是,只会触发一个事件,即堆栈“
我是 javascript 的新手,我对将 onclick 事件更改为 mouseover 有疑问,请帮忙 $(document).ready(function() { (function ($)
我的菜单是移动响应式的,因为它会在适用的情况下调整大小并在移动设备上变成汉堡包菜单。 我的问题是菜单还有一个子菜单元素,该元素也应该在移动设备上可见,但由于移动设备上没有鼠标悬停,“点击”会将查看器带
我知道这个话题已经被多次提出,但是我对在鼠标悬停上显示图像有点困惑。我目前有一个带有彩色背景的 div 容器,当您悬停它时会显示该容器。 click here - 向下滚动底部的图像 我遇到的问题是我
所以使用 this as a starting point我正在尝试将元素从一个滚动溢出拖到另一个滚动溢出,我已经完成了。问题是一旦元素(或者更确切地说是元素的克隆)在另一个滚动溢出中,它们就不会响应
刚开始学习 Javascript,这非常困难。但是我遵循了一个教程并按照他在他的视频中所说的那样做了,但我的结果仍然不是我所期望的,也不是他在他的视频中得到的。我想知道为什么会这样,我该如何解决? 我
我是一名优秀的程序员,十分优秀!