本文介绍了鼠标向上/点击事件不会触发后translateZ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个一个标签,链接到另一个页面。当用户点击这个链接,我有一个 mouseDown 事件触发,它应用一个 translateZ 到元素。

I've got an a tag, which links to another page. When the user clicks on this link, I have a mouseDown event fire, which applies a little translateZ to the element.

奇怪的是,在 translateZ 之后,鼠标向上或点击事件火。

Strangely though, after the translateZ, the mouse up or click event (which relies on mouseup) doesn't fire.

似乎在Firefox中工作正常,但不是chrome。

Seems to work fine in Firefox, but not chrome.

这里是一个小jsfiddle显示我的问题:

Here is a little jsfiddle showing my problem: http://jsfiddle.net/8LMzb/9/

推荐答案

因为这在Firefox中工作,我不太确定它的一个chrome错误或预期的行为..也不是这个修复将继续工作。我做了什么,不是应用任何透视到变换,直到mousedown事件被触发,这,以某种方式允许mouseup事件触发,并链接到工作。

Since this works in firefox, I'm not quite sure that its a chrome bug, or expected behavior.. nor whether this fix will continue to work. What I've done, is not apply any perspective to the transform until the mousedown event is fired, this, somehow allows the mouseup event to fire, and links to work.

Relavent fiddle:

Relavent fiddle: http://jsfiddle.net/8LMzb/152/

这篇关于鼠标向上/点击事件不会触发后translateZ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 06:45