In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "how to realize the hidden elements of jquery". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Implementation: 1, use css () to add visibility style to the element, set invisible, syntax "element object .css ('visibility','hidden');"; 2, use css () to set the transparency of the element to 0, syntax "element object .css (' opacity',0)".
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
There are two ways to implement occupancy hiding elements:
Add visibility: hidden; style to the element
Add opacity: 0 style to the element
In jquery, you can use the css () method to achieve the above effect:
1. Use css () to add visibility style to the element, and the setting is not visible.
$(document) .ready (function () {$("button") .click (function () {$(".blank") .css ("visibility", "hidden");});}) Normal display element hidden element normal display element
Occupies a position to hide elements
Description:
The visibility attribute specifies whether the element is visible.
This attribute specifies whether to display an element box generated by an element. This means that the element still occupies its original space, but it can be completely invisible. The value collapse is used in the table to delete columns or rows from the table layout.
Method 2: use css () to set the transparency of the element to 0
$(document) .ready (function () {$("button") .click (function () {$(".opacity") .css ('opacity',0);});}) Normal display element hidden element normal display element
Occupies a position to hide elements
Description:
The opacity attribute means to set the transparency of an element. It is not designed to change the element's bounding box (bounding box).
This means that setting opacity to 0 can only visually hide elements. The element itself still occupies its own place and plays a role in the layout of the page. This is similar to visibility: hidden above.
This is the end of the content of "how jquery achieves location-occupying hidden elements". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.