简体   繁体   English

如何以编程方式更改破折号中按钮的可见性?

[英]How to change the vibility of a button in dashcode programmatically?

i'm using dashcode for a webapp and in order to add a + button in the browser bar to a specific view i need to hide and unhide that + button. 我正在为Web应用程序使用破折号,并且为了在浏览器栏中向特定视图添加+按钮,我需要隐藏和取消隐藏该+按钮。 The problem is i really don't know how to do this. 问题是我真的不知道该怎么做。 I tried to write on the screen all the button's properties and in fact there is a visible parameter but when i display the value it shows "null" knowing that the button is visible... 我试图在屏幕上写所有按钮的属性,实际上有一个可见的参数,但是当我显示该值时,它会显示“ null”,因为知道按钮是可见的...

So anyone has got an idea ? 有人知道吗? Thanks a lot ! 非常感谢 !

you can do this in two ways. 您可以通过两种方式执行此操作。

1)use display and toggle it (block/none) 2)use visibility and toggle it (visible/hidden) 1)使用显示并切换(阻止/无)2)使用可见性并切换(可见/隐藏)

If you want to know the difference between display and visibility, look at display docs 如果您想了解显示和可见性之间的区别,请查看显示文档

put the button in a div 将按钮放入div

<div id="peekaboo">button</div>

then in the css set the visibility of peekaboo to the initial state visible or hidden then write a JavaScript function which will switch the css style state to visible or hidden as required. 然后在css中将peekaboo的可见性设置为可见或隐藏的初始状态,然后编写一个JavaScript函数,该函数将根据需要将css样式状态切换为可见或隐藏。

Sorry i am away from my base computer so cannot access the code samples. 抱歉,我不在我的基本计算机上,因此无法访问代码示例。 can post better code tonight if you still need it 如果您仍然需要,可以在今晚发布更好的代码

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

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