鼠标“向下/向上”和“进入/离开”与透明 Flash 对象重叠的按钮的样式

发布于 2024-12-19 10:01:55 字数 619 浏览 4 评论 0原文

我有一个 Flash 对象,其尺寸和位置与 HTML 按钮相同。该按钮位于 Flash 对象下方。我希望当单击并悬停 Flash 时,该按钮的样式就像同时单击并悬停一样。

我试图

ExternalInterface.call("mouseEventHandle", elementId, eventName);

在 Flash 中调用:将事件传递给 JS。

在 JS (coffeescript) 中:

window.mouseEventHandle = (elementId, eventName) ->
    id = '#' + elementId
    switch event
        when "down" then console.log("down")
        when "up" then console.log("up")
        when "enter" then console.log("enter")
        else console.log("leave") # leave

该函数负责设置 HTML 按钮的样式。

问题是如何在JS中设置按钮的样式?或者还有其他方法可以达到目的吗?

I have a Flash object which dimension and position are as same as the HTML button. The button is under the flash object. I want when the Flash is clicked and hovered, the button has the styles as if it is clicked and hovered at the same time.

I am trying to call:

ExternalInterface.call("mouseEventHandle", elementId, eventName);

in Flash to pass event to JS.

And in JS (coffeescript):

window.mouseEventHandle = (elementId, eventName) ->
    id = '#' + elementId
    switch event
        when "down" then console.log("down")
        when "up" then console.log("up")
        when "enter" then console.log("enter")
        else console.log("leave") # leave

the function is responsible for styling the HTML button.

The question is how to style the button under in JS? Or is there other way to achieve the goal?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沫尐诺 2024-12-26 10:01:55

我最终使用了jquery按钮:

$("input[class!='hidden-input']").button()

所以处理函数看起来像:

window.mouseEventHandle = (id, event) ->
        switch event
            when "e" 
                $(id).addClass("ui-state-hover")            # enter
                return false
            when "l" 
                $(id).removeClass("ui-state-hover ui-state-active")     # leave
                return false
            when "d" 
                $(id).addClass("ui-state-active")           # down
                return false
            else 
                $(id).removeClass("ui-state-active ui-state-hover") # up
                return false

返回“false”允许浏览器快速反应。

I finally use jquery buttons:

$("input[class!='hidden-input']").button()

so the handler function looks like:

window.mouseEventHandle = (id, event) ->
        switch event
            when "e" 
                $(id).addClass("ui-state-hover")            # enter
                return false
            when "l" 
                $(id).removeClass("ui-state-hover ui-state-active")     # leave
                return false
            when "d" 
                $(id).addClass("ui-state-active")           # down
                return false
            else 
                $(id).removeClass("ui-state-active ui-state-hover") # up
                return false

returning "false" allows browsers have quick reaction.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文