简体   繁体   English

隐藏按钮,但带有空白

[英]Hide button but with white space

I have this system where I decided to hide all buttons and later(on the bottom of the page) make them visible again as a jQuery button. 我在这个系统中决定隐藏所有按钮,稍后(在页面底部)将它们再次显示为jQuery按钮。

On the beginning: 在开始时:

$('button').hide();

On the end: 最后:

$('button').button(...button options yadda yadda...);

And my scripts are loaded on the bottom of the page as recommended. 按照建议,我的脚本会加载到页面底部。

When the page renders, it renders without buttons, and don't render their empty spaces. 页面呈现时,它呈现时没有按钮,也不呈现其空白区域。 But when the jquery comes to action the page flicks and expands the empty spaces where the buttons will be rendered and render them. 但是,当jquery起作用时,页面就会滑动并展开空白空间,在这些空白处将呈现按钮并进行呈现。

How can I make the page render the button spaces even when they are hidden? 如何隐藏隐藏的按钮空间?

Use visibility property of button instead of hide() / Show() function, hide() uses display:none, read more over here 使用按钮的visibility属性代替hide() / Show()函数,hide()使用display:none,请在此处阅读更多内容

To show 显示

$('button').css('visibility', 'visible');

To Hide 隐藏

$('button').css('visibility', 'hidden');

If I understand your question correctly. 如果我正确理解您的问题。

The jQuery function hide() sets element to display:none; jQuery函数hide()将元素设置为display:none; in CSS. 在CSS中。 For the document to keep the elements space you need to set the element to 为了使文档保持元素空间,您需要将元素设置为

visibility: hidden;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM