javascript - 检测按钮点击 z-index -1

标签 javascript jquery html css

嗨,这是我的 Jsfiddle代码。有一个从右到左的动画,然后从左到右,当动画停止时,汽车图像从底部出现。我想检测汽车图像是否被点击,然后我必须打开一个新窗口。汽车图像 z-index 设置为 -1,以便关闭按钮可见,但如果我无法检测到点击功能。我该怎么做才能让它发挥作用。 当我们点击关闭按钮时,它会隐藏所有内容并显示一个 div。

#car_slider {
    position:fixed;
    bottom:-10px;
    width:300px;
    height:0;
    border:2px solid #000;
    z-index: -1;

}

我尝试使用这行代码,但它没有检测到点击。

$("#car_slider").click(function() {
    window.open('//www.google.com', '_blank');
});

最佳答案

把z-index:1;

    #car_slider {
        position:fixed;
        bottom:-10px;
        width:300px;
        height:0;
        border:2px solid #000;
        z-index: 1;
}

demo

关于javascript - 检测按钮点击 z-index -1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30231457/

相关文章:

javascript - 我怎样才能改变这个输入的值?

php - 可编辑占位符问题

javascript - 一键删除 contenteditable div 中的整个 anchor 标记

jquery - 创建对 jQuery.data 键的本地引用

javascript - 使用 Google Maps V2、Facebook Comments 等在 GWT(Google App Engine)中构建 HTML View - 布局?

javascript - AngularJS 找不到带有最新 RequireJS 的模块

javascript - 从混淆的字符串中识别正确的单词(随机位置的意外空格)

javascript - Netbeans 字段验证(字母\数字\长度)

Javascript 和 mongodb,如何将条件数组传递给查询

Jquery选择器: How to: change the src attribute of an image tag on link hover