代码之家  ›  专栏  ›  技术社区  ›  munson

如何阻止视差叠加干扰窗体和链接字段?

  •  0
  • munson  · 技术社区  · 7 年前

    我已经在PHP站点的索引页面中实现了简单的视差图像。由于某种原因,由于我实现的视差标头,登录表单表现不正常。在这张照片上有一个由div放置的图像覆盖,我将其命名为logo。我可以肯定这是罪魁祸首,因为当我把它注释掉时,表单字段和链接就起作用了。网站位于 http://www.mattmacy.com/greenia/ . 请确保表单字段不起作用。我已经为我的3张图片和logo类添加了css。任何帮助都将不胜感激。

    <!DOCTYPE html>
    <html>
    <head>
    <title>FORUM</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    </head>
    
    <body style="background-color: maroon";>
    <div style= "background-color: gold; border-style: solid;">
    
    //This "logo" div stops my form and link fields from working  
    <div class="pimg1">
    <div class="logo"></div>
    </div>
    
    <div style="background-color: gold; border-style: solid;">
    <h1>Matt Macy's Forum</h1>
    
    <?php
    session_start();
    if (!isset($_SESSION['uid'])){
    echo "<form action='login_parse.php' method='post'>
    Username: <input type='text' name='username' />&nbsp;
    Password: <input type='password' name='password' />&nbsp;
    <input type='submit' name='submit' value='Log In'/></form>";
    echo "You can joing this site with Admin approval <a 
    href='register.php' class='Links'>Register</a>";
    }else {
        echo "You are logged in as ". $_SESSION['username']. "with a level 
    of " . $_SESSION['level']."<a href='logout_parse.php' 
    class='Links'>Logout</a>";
    }   if (isset($_SESSION['level']) && ($_SESSION['level'] == 'Admin')){
            echo "<a href='authenticate.php' 
    class='authenticate'>Authenticate</a>";
            echo "<a href='postAudiowithPayPal.php' 
    class='postAudiowithPayPal'>Post audio with PayPal</a>";
    
    }
    echo"</div><br>";
    //This is my second parallax image that doesn't cause difficulty
    echo"<div class='pimg2'><span class='border'></span></div>";
    

    这是我的风格。css文件。我不确定是否需要设置我为链接指定的链接类的样式。

    .pimg1{
    background-image:url('pimg1.jpg');
    min-height:100%;
    height:600px;
    }
    
    .pimg2{
    background-image:url('pimg2.jpg');
    min-height:100%;
    height:500px;
    }
    .pimg3{
    background-image:url('pimg3.jpg');
    min-height:100%;
    height:500px;
    }
    
    @media(max-width:568px){
    .pimg1, .pimg2, .pimg3{
        background-attachment: scroll;
    }
    }
    
    .logo{
    height: 100%;
    width: 100%;
    background-image:url('SpiritualAutomaton2.png');
    position: center;
    background-repeat: no-repeat;
    position: absolute;
    top:50%;
    margin-top:-50px;
    margin-left:130px;
    
    
    }
    .Links{
          ?
    }
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   JasonB    7 年前

    问题是你的 .logo 身高尝试使用与正在使用的图像相同的大小作为背景。您可以在该图像中看到,将鼠标放在最左侧的输入上并向右移动,徽标div正在阻止下面的元素。另一个选项是设置 pointer-events:none; .标志 元素,但在这种情况下有点粗糙。

    enter image description here