jquery移动按钮并没有隐藏在风格上



嗨,我们正在研究 jquery Mobile 如何用 CSS 而不是我们使用的代码隐藏按钮 显示:风格上没有,但它不适用于 jqueryMobile这是我们使用的代码

<!DOCTYPE html>
<html>
   <head>
      <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
      <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
      <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
   </head>
   <body>
      <div data-role="page" id="pageone">
         <div data-role="header">
            <h1>Buttons</h1>
            <button data-role="button" style="display:none;">hello</button>
         </div>
         <div data-role="footer">
            <h1>Footer Text</h1>
         </div>
      </div> 
   </body>
</html>

最简单的方法是将按钮包装在 DIV 中,然后隐藏/显示它。

<div style="display:none;">
    <button data-role="button">hello</button>
</div>
<style>
  #pageone .ui-header > .ui-btn{display:none;}
</style>

首先,尝试编辑属性,如"display: none !important"。如果它还没有工作,那么检查你是否已经声明了按钮的"显示:阻止!important;"属性。 (或)在内部/外部样式表中编写个人样式,例如,

#pageone .ui-header > .ui-btn { display:none !important; }

如果要随代码移动,请将"显示:无"更改为visibility: hidden

$( ".target" ).hide();

这大致相当于调用.css("display", "none"),只是显示属性的值保存在jQuery的数据缓存中,以便以后可以恢复显示到其初始值。如果元素的显示值为内联,并且被隐藏然后显示,它将再次以内联方式显示。

最新更新