DOM元素活动状态问题(DOM Element Active State Issue)

编程入门 行业动态 更新时间:2024-10-27 12:35:43
DOM元素活动状态问题(DOM Element Active State Issue)

我正在尝试实现一种效果,当我点击一个DOM元素,在这种情况下是一个list ,目标list将旋转并保持这种方式。

这有点难以解释,所以这里是我目前正在进行的工作的链接 。

当你长按圆形灰色物体时,菜单列表会慢慢显示出来。 然而,一旦你放手它就会再次消失。

我的目标是在圆形灰色物体上单击一次就会显示菜单并且菜单会保持显示状态。

它很长,所以我只会给你css链接 。

I'm trying to achieve an effect when I click on a DOM element, in this case a list, the target list would rotate and stay that way.

It's kind of hard to explain so here's the link to what I am currently working on.

When you long press on the rounded gray object a list of menu would slowly reveal. However, once you let go it'll disappear again.

The behavior I'm aiming is that clicking just once on the rounded gray object would reveal the menu and that the menu stays revealed.

It's quite long so I'll just give you the css link instead.

最满意答案

从概念上讲,您可以拥有mousedown和mouseup事件的处理程序,以及两者都可访问的计时机制。

在mousedown上,你启动计时机制并启动慢动画。

在鼠标中你也可以

如果mousedown的时间滞后低于某个阈值(即快速点击),则完成动画

结束动画并将菜单返回到未打开状态,如果自moused以来的时滞超过阈值(即点击+保持)

Well after further research and fumbling with css and jquery I finally solved it.

My lack of understanding of css is at fault here.

Bottom line: I just had to override the default state of the DOM element via jquery in order to keep the menu from hiding again once clicked.

You can check the result here.

Thanks for the suggestions though. I appreciate it!

更多推荐

list,I'm,电脑培训,计算机培训,IT培训"/> <meta name="description&quo

本文发布于:2023-08-06 00:51:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1442116.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:元素   状态   DOM   Element   Issue

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!