将可点击的div添加到背景div中

时间:2016-01-25 15:46:21

标签: jquery html css

我想在我的div中添加一个可点击的文本,但问题是当我把我的div放置一个位置背景(z-index:-1)时,文本不可点击,当我改变时(z-index: 0)工作正常,但我的div不在后台,任何人都可以帮助我谢谢:)

    <html>
    <head>
        <title>background</title>
        <script src="js/jquery.js"></script>
        <style type="text/css">
            .background-i{
                position: absolute;
                z-index: -1;
                top:0px;
                left: 0px;
                margin: 0;
                width: 100%;
                height: 1000px;
                background-color: red;
            }
            .test{
                float: right;
                text-align: right;
                text-decoration: underline;
                position: relative;
                width   : 100 ;
                height  : 30;
                margin-right: 10px;
                margin-top: 10px;
                cursor:pointer;
                background-color: red;
            }

        </style>
        <script type="text/javascript">
            $(document).ready(function() {
                $('.ff').click(function(){
                alert('heeloo');
                });
            });
        </script>
    </head>


    <body >
    <button class='ff'>lolokkk</button>
    <button clas='close'>lolo</button><br><br>


<div class="background-i">  
    <div class="test" style="border:1px solid">
        <span class="ff">Close X</span>
    </div>
</div>


    <button>lolo</button><br><br>

    </body>
</html>

0 个答案:

没有答案
相关问题