This article shares the specific code of the jQuery plug-in to achieve image suspension for your reference. The specific content is as follows A very common effect is that the picture will float and display after clicking. The effect is as followsCode section<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Make the picture float</title> <script src="js/jquery-3.4.1.min.js"></script> <style> * { margin: 0px; padding: 0px; user-select: none; } ul { margin-left: 20px; } ul li{ width: 200px; } li img { width: 100%; } .float{ position: fixed; top: 10%; left: 10%; width: 80%; list-style: none; z-index: 99; } .float::before{ content: ''; position: fixed; width: 100%; height: 100%; left: 0; top: 0; z-index: 98; } </style> </head> <body> <ul> <li class="li"><img src="img/1.png" /></li> <li class="li"><img src="img/2.png" /></li> <li class="li"><img src="img/3.png" /></li> <li class="li"><img src="img/4.png" /></li> </ul> </body> </html> <script> $(".li").click(function() { $(this).toggleClass('float') }) </script> Explanation of ideasIt's about changing from one state to another, giving and taking away a class. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of Linux text processing command sort
>>: Centos7.5 configuration java environment installation tomcat explanation
Forwarding between two different servers Enable p...
tar backup system sudo tar cvpzf backup.tgz --exc...
When nginx configures proxy_pass, the difference ...
Redis is a distributed cache service. Caching is ...
Table of contents Purpose of the table For exampl...
Table of contents Set is a special collection who...
Autotrash is a command line program that automate...
In fact, XHTML 1.0 is divided into two types (thr...
Recently, Microsoft released the 2019 server syst...
Table of contents 1. Introduction to label statem...
This article introduces the sample code of CSS3 t...
Table of contents Object.prototype.valueOf() Obje...
1. Introduction When a web project is published o...
Our bank's MGR will be launched at the end of...
Table of contents 1. Define object methods 2. Def...