再点击jQuery(Second click jQuery)
我试图制作一个动画,当我点击一个搜索图标时,它会淡入搜索输入并添加一个类以使其更宽。 问题是我不知道在搜索输入已经显示之后如何在第二次点击时使其变为fadeOut:
这是我的代码:
$('#menu_search').click(function(){ $('.search_input').fadeIn().toggleClass('full'); }); <li id="menu_search"> <a href="javascript:void(0)"></a> <div class="search_input_container"> <input type="text" class="search_input" value="Buscar"> </div> </li> &#menu_search{ background: url('../img/sprites.png') #000 2px 2px; width: 34px; height: 28px; padding: 0; margin-right: 0; a{ display: inline-block; width: 100%; height: 100%; } .search_input_container{ width: 500px; height: 30px; position: absolute; z-index: 20; left: -466px; .search_input{ float: right; width: 100px; background: #ffffff; height: 30px; border: none; .round_corners(); .animate(); display: none; &.full{ width: 772px; display: block; } } } }
I´m trying to make an animation that when I click on a search icon, it fadeIn the search input and add a class to make it wider. The problem is that I don´t know how to make it fadeOut in the second click after the search input it´s already displayed:
this is my code:
$('#menu_search').click(function(){ $('.search_input').fadeIn().toggleClass('full'); }); <li id="menu_search"> <a href="javascript:void(0)"></a> <div class="search_input_container"> <input type="text" class="search_input" value="Buscar"> </div> </li> &#menu_search{ background: url('../img/sprites.png') #000 2px 2px; width: 34px; height: 28px; padding: 0; margin-right: 0; a{ display: inline-block; width: 100%; height: 100%; } .search_input_container{ width: 500px; height: 30px; position: absolute; z-index: 20; left: -466px; .search_input{ float: right; width: 100px; background: #ffffff; height: 30px; border: none; .round_corners(); .animate(); display: none; &.full{ width: 772px; display: block; } } } }
原文:https://stackoverflow.com/questions/15269581
满意答案
你需要一个中间
char
数组来打印strcat
前的数字,或者你可以直接将数字rv
,但是为此你需要一个指向结尾的指针,char *rv = malloc(2048); char *rv_end = rv; ... rv_end += sprintf(rv_end, "%d", fib(num));
并在将其他内容附加到缓冲区时更新
rv_end
指针。(感谢jthill使用
sprintf
的返回值进行改进。)You need either an intermediate
char
array to print the number to beforestrcat
ing, or you can directlysprintf
the number torv
, but for that you need a pointer to the end,char *rv = malloc(2048); char *rv_end = rv; ... rv_end += sprintf(rv_end, "%d", fib(num));
and also update the
rv_end
pointer when appending other things to the buffer.(Thanks to jthill for the improvement using the return value of
sprintf
.)
相关问答
更多在C中使用strcat(Using strcat in C)
strcat C不打印,int为char *(strcat C not printing and int to char*)
C函数使用strcat和字符串(C function using strcat with strings)
如何使用strcat()函数?(How to use strcat() function?)
strcat用char指向字符串文字(strcat with char pointer to a string literal)
用字符串和int使用strcat()的最有效方法是什么?(Most efficient way to use strcat() with a string and int?)
strcat溢出?(strcat overflow?)
strcat后自由分配的字符串(Free allocated string after strcat)
这个简单的代码使用字符串,malloc和strcat有什么问题?(What's wrong with this simple code using strings, malloc and strcat?)
strcat的错误(Errors with strcat)
相关文章
更多jQuery点击滑过左则菜单
jquery 问题
jquery 插件开发
jquery与servlet交互的json问题
Jquery 的IFame ready 问题?
jQuery表格插件jqGrid(jquery.jqGrid.js)
Jquery EasyUI系列教程4
解决点击没有内容的空白div没有响应click事件的方法
jquery可编辑表格
jQuery中$与$()的区别?
最新问答
更多python的访问器方法有哪些
使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
透明度错误IE11(Transparency bug IE11)
linux的基本操作命令。。。
响应navi重叠h1和nav上的h1链接不起作用(Responsive navi overlaps h1 and navi links on h1 isn't working)
在C中读取文件:“r”和“a +”标志的不同行为(Reading a File in C: different behavior for “r” and “a+” flags)
NFC提供什么样的带宽?(What Kind of Bandwidth does NFC Provide?)
元素上的盒子阴影行为(box-shadow behaviour on elements)
它看起来像只在Windows上的Chrome的错误。 我在Google Canary (Chrome 63)中也进行了测试,问题依然存在,所以有可能它不会很快修复。 这个问题是由overflow: auto引起的overflow: auto ,在你的情况下,它可以很容易地通过删除或设置为可见(默认)来解决。 但是 ,将鼠标悬停在右侧(顶部和底部)时,会出现滚动条。 一个解决方案可以设置overflow: hidden的身体,所以预期的结果是所需的。 我想指出,这不是一个很好的解决方案,但我建议暂
Laravel检查是否存在记录(Laravel Checking If a Record Exists)
这取决于您是否要以后与用户合作,或仅检查是否存在。 如果要使用用户对象(如果存在): $user = User::where('email', '=', Input::get('email'))->first(); if ($user === null) { // user doesn't exist } 如果你只想检查 if (User::where('email', '=', Input::get('email'))->count() > 0) { // user found
设置base64图像的大小javascript - angularjs(set size of a base64 image javascript - angularjs)
$scope.getData= function () { var reader = new FileReader(); reader.onload = $('input[type=file]')[0].files; var img = new Image(); img.src =(reader.onload[0].result); img.onload = function() { if(this.width > 640
Copyright ©2023
peixunduo.com All
Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!
Laravel检查是否存在记录(Laravel Checking If a Record Exists)
设置base64图像的大小javascript - angularjs(set size of a base64 image javascript - angularjs)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!