Home > Web Front-end > HTML Tutorial > 子DIV可以在父DIV中移动的效果_html/css_WEB-ITnose

子DIV可以在父DIV中移动的效果_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:08:50
Original
1629 people have browsed it

我想做个子DIV可以在父DIV中移动的效果。如图在子DIV中有两个DIV ,鼠标拖动子DIV可以在父DIV中移动已经做好了,但是我现在想让鼠标拖动DIV2时子DIV不动 怎么做?
请各位大神帮帮忙。


回复讨论(解决方案)

你的意思是 DIV2 可单独在 父DIV 里被拖动,是这样吗?

你的意思是 DIV2 可单独在 父DIV 里被拖动,是这样吗?


不是哦 我的意思是 按住DIV2时 整个子div都不能动,div2在子DIV中也不能动

即子DIV失去移动效果

event.stopPropagation();
//阻止事件冒泡

阻止掉div2的拖动事件。。。

阻止掉div2的拖动事件。。。



可是应该怎么做呢 能具体些么
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template