The example in this article describes how to implement the jquery search box effect. Share it with everyone for your reference. The specific implementation method is as follows:
Supplementary note: It is not perfect. If the search box originally had other styles, when it loses focus, if the code in the example is used, the other styles will be gone, because attr() is to set the style. If you use addClass() to add a style, it is not very suitable. Although it can achieve the effect, the original c2 style is still there, and it is just replaced by the c1 style when displayed (this requires the c1 style to be written after c2). There seems to be no way to replace the style?
After modification, the above problems are solved, and it is a more perfect version (the code can also be optimized to make it simpler)
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn