In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article, the editor introduces in detail "what is the basic operation in JQuery", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "what is the basic operation in JQuery" can help you solve your doubts.
1. DOM operation of jQuery
1. Content operation
1. Html (): get / set the tag body content of the element-- > content
2. Text (): gets / sets the tag body plain text content of the element-- > content
3. Val (): gets / sets the value of the value attribute of the element
two。 Attribute operation
1. General attribute operation
1. Attr (): get / set the attributes of an element
2. RemoveAttr (): delete an attribute
3. Prop (): get / set the attributes of an element
4. RemoveProp (): delete an attribute
* the difference between attr and prop?
1. If you are manipulating inherent attributes of an element, it is recommended that you use prop
two。 If you are manipulating attributes that are customized by the element, it is recommended that you use attr
two。 Operation on the class attribute
1. AddClass (): add class attribute value
2. RemoveClass (): delete the class attribute value
3. ToggleClass (): toggles the class property
* toggleClass ("one"):
* determine that if class= "one" exists on the element object, the attribute value one will be deleted. If class= "one" does not exist on the element object, add
4. Css (): change the style
Second, there are three ways to display jQuery animation:
1. Default show and hide method
1. Show ([speed, [easing], [fn]])
Parameters:
1. Speed: the speed of animation. Three predefined values ("slow", "normal", "fast") or millisecond values that represent the duration of the animation (e.g. 1000)
2. Easing: used to specify the switching effect. The default is "swing" and the parameter "linear" is available.
* swing: the effect of animation execution is slow first, fast in the middle, and slow at last
* linear: the speed of animation execution is uniform.
3. Fn: a function executed when the animation is complete, once for each element.
2. Hide ([speed, [easing], [fn]])
3. Toggle ([speed], [easing], [fn])
two。 Slide show and hide mode
1. SlideDown ([speed], [easing], [fn])
2. SlideUp ([speed, [easing], [fn]])
3. SlideToggle ([speed], [easing], [fn])
3. Fade in and out show and hide mode
1. FadeIn ([speed], [easing], [fn])
2. FadeOut ([speed], [easing], [fn])
3. FadeToggle ([speed, [easing], [fn]])
Case III: advertising display and concealment
Demand:
1. When the page is loaded, 3 seconds later. Automatic display of ads
two。 The advertisement disappears automatically after 5 seconds.
Analysis:
1. Use a timer to do it. SetTimeout (execute timer once)
two。 According to the analysis, it is found that the display and hiding animation effect of JQuery is actually controlling display.
3. Use show/hide method to complete the display of advertisements
Code case
Automatic display and hiding of advertisements # content {width:100%;height:500px Background:#999} / / entry function, which defines a timer after the page is loaded, calls the two methods $(function () {/ /) to define a timer, and executes setTimeout (adShow,3000) 3 seconds after calling the adShow method. / / define timer, call adHide method, execute setTimeout (adHide,8000) once after 8 seconds;}); / / display ad function adShow () {/ / get ad div, call display method $("# ad") .show ("slow") } / / Hidden advertisement function adHide () {/ / get ad div, call concealment method $("# ad"). Hide ("slow");}
The body part reads here, this article "what is the basic operation in JQuery" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more related articles, welcome to follow the industry information channel.
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.