Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set jquery Click div left slide hide

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "jquery how to set click div left slide hide", the editor shows you the operation process through the actual case, the operation method is simple and fast, practical, hope that this "jquery how to set click div left slide hide" article can help you solve the problem.

Method: 1, use "$(" div ") .click (function () {})" to add a click event to the div element, and specify the event handler function; 2, in the function with "$(this). Animate ({right:" left distance ", opacity:'0'}, time);" can be set.

The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.

How to set jquery Click div left slide hide

The animate () method performs a custom animation of the CSS property set.

This method changes an element from one state to another through the CSS style. The value of the CSS property changes gradually so that you can create an animation effect.

Only numeric values can create animations (such as "margin:30px"). String values cannot create animations (such as "background-color:red").

Tip: use "+ =" or "- =" to create relative animation.

Grammar

(selector) .animate ({styles}, speed,easing,callback)

Parameter description

Styles is required. Specifies one or more CSS attributes / values that produce animated effects.

Note: when used with the animate () method, the property name must be written as a hump: you must use paddingLeft instead of padding-left,marginRight instead of margin-right, and so on.

Examples are as follows:

(function () {$("# panel") .click (function () {$(this) .animate ({right: "100px", opacity:'0'}, 2000);}) * {margin: 0; padding: 0;} body {padding: 100px } # panel {position: relative; width: 100px; height: 100px; border: 1px solid # 0050D0; background: # 96E555; cursor: pointer;}

Output result:

This is the end of the introduction to "how to set up jquery and click on div left slide hide". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report