简体   繁体   English

在隐藏的DIV上自动调整输入文本区域的宽度

[英]Auto resize the width of input text area on hidden DIV

I use a Hide/Show .js script that hides some checkboxes and on the right side there is the search field when I click to hide it I want to expand. 我使用一个Hide / Show .js脚本来隐藏一些复选框,并且当我单击以隐藏它要扩展时,在右侧是搜索字段。

Ex. 例如

Before hidding: 隐藏之前:

Before hidding Image 隐藏图像之前

After hidding I want the search field to be expanded 100% 隐藏后,我希望将搜索范围扩大100%

After hidding Image 隐藏图片后

I searched for 2 days something and can't find a way to make it expand I use the bTemplate engine to store the HTML code. 我搜索了两天的内容,但找不到使其扩展的方法,我使用bTemplate引擎来存储HTML代码。

Did you try changing the CSS properties through the "setAttribute" method of the elements in question through Javascript? 您是否尝试通过Javascript通过有问题的元素的“ setAttribute”方法更改CSS属性? Basically, the code you used to "hide some of the checkboxes" in the first place is pretty much like how you'd write the code to do the other things you're looking to do. 基本上,您最初用于“隐藏某些复选框”的代码非常类似于您编写代码以执行其他操作的方式。

In other words, When you want the checkboxes out of view and the text entry box centered, as in your second reference pic, you could have the Javascript code written through the "setAttribute" method so that when a particular event happens, the css "display" parameter for the check boxes could be set to "hidden", the size of the text entry box can be increased, and the css "position" parameter for the text entry box can be set to have it centered, etc. 换句话说,如您的第二个参考图片所示,当您希望复选框不可见且文本输入框居中时,您可以通过“ setAttribute”方法编写Javascript代码,以便在发生特定事件时,“ css”可以将复选框的“显示”参数设置为“隐藏”,可以增加文本输入框的大小,并且可以将文本输入框的css“位置”参数设置为居中,等等。

That is, of course if I understand your issue correctly. 也就是说,当然,如果我能正确理解您的问题。 Can you provide the code you are using? 您能提供您正在使用的代码吗? I'm sure me or someone else could clarify things more if we could see what you have written. 我相信,如果我们能看到您写的内容,我或其他人可以进一步澄清。

Hope that helps at least a little! 希望至少能有所帮助! :) :)

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

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