CSS的可见性不适用于移动设备?

时间:2014-07-24 07:31:03

标签: javascript html css mobile

<html> 
  <head> 
    <script type="text/javascript"> 
      function show() { 
        document.getElementById("dd").style.visibility = "visible"; 
        document.getElementById("dd").style.position = "relative"; 
      } 
    </script> 
  </head> 
  <body> 
    <div style="width:30%; float:left"> 
      <div class="nav" style=" background-color:Red"> <a href="home.html"> Home</a>
      </div> 
      <div class="nav" style=" background-color:Red"><a href="abt.html"> About US</a>
      </div> 
      <div class="nav" style=" background-color:Red"><a href="client.html"> Client</a>
      </div>        
      <div class="nav" style=" background-color:Red"><a href="cont.html"> Contact</a>   
      </div>
    </div> 
    <div style="width:70%; float:left; "> 
      <a href="#" onclick="show()">dropdown</a> 
      <div style="position:absolute; visibility:hidden" id="dd">
        We, We carry out erection, testing, commissioning and maintenance services             
        We have an excellent reputation, a quality work ethic and a team of qualified and        
        highly experienced workforce.
      </div>      
    </div>
  </body> 
</html> 

想法是点击dropdown链接,div#dd将会显示。它适用于PC浏览器,但它不适用于移动设备。虽然,其他JavaScripts(如window.alert)也有效。

知道为什么这不起作用吗?

0 个答案:

没有答案