Home  >  Article  >  Web Front-end  >  jQuery implements draggable wishing wall effect

jQuery implements draggable wishing wall effect

不言
不言Original
2018-07-02 15:05:212333browse

This article mainly introduces jQuery to realize the drag-and-drop wishing wall effect, which can realize drag-and-drop pictures and cascading display functions. It involves the simple use of jQuery plug-ins. It also comes with demo source code for readers to download and refer to. Friends in need can refer to it. Next

The example in this article describes the draggable wishing wall effect achieved by jQuery. Share it with everyone for your reference, the details are as follows:

The operation effect diagram is as follows:

Here is a brief introduction to the function points:

① Randomly display the background image or background color
② The appearing position is random
③ You can change the position by dragging

Okay, here is the code:

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8"/>
  <title>许愿墙</title>
  <link rel="stylesheet" href="base.min.css"/>
  <style>
  #wish{height:650px;margin:20px;position:relative;width:960px;}
  .wish{background:url(wish_bg.png) no-repeat 0 0;color:#000;height:166px;padding:10px 20px 30px 20px;width:185px;}
  .wish-close{background:url(wish_close_bg.png) no-repeat 0 0;display:none;position:absolute;right:5px;top:-5px;width:17px;height:17px;}
  </style>
</head>
<body>
  <ul id="wish">
    <li>11111</li>
    <li>22222</li>
    <li>33333</li>
    <li>44444</li>
    <li>55555</li>
  </ul>
</body>
</html>
<script src="jquery.min.js"></script>
<script src="jquery-ui.min.js"></script>
<script src="wish.js"></script>
<script>
$(function(){
  $(&#39;#wish&#39;).wish();
  $(&#39;.wish&#39;).draggable({containment:&#39;#wish&#39;,scroll:false});
});
</script>

Note:

jqueryui needs to load draggable and scale Effect. Draggable supports dragging, while scale Effect is the effect of clicking to close.

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

JQuery and canvas realize the flat throwing and color dynamic transformation effect

jQuery lower right corner rotation Implementation of ring menu special effects

The above is the detailed content of jQuery implements draggable wishing wall effect. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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