html许愿墙源码,jQuery实现可拖拽的许愿墙效果

这篇文章主要介绍了jQuery实现可拖拽的许愿墙效果,可实现拖拽图片与层叠显示功能,涉及jQuery插件的简单使用,并附带demo源码供读者下载参考,需要的朋友可以参考下

本文实例讲述了jQuery实现可拖拽的许愿墙效果。分享给大家供大家参考,具体如下:

运行效果图如下:

6e43dfc18c0ef99738bd650873d526c4.png

这里简单介绍下功能点:

① 随机显示背景图或背景色

② 出现的位置随机

③ 可以通过拖拽改变位置

好了,附上代码:

许愿墙

#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;}

  • 11111
  • 22222
  • 33333
  • 44444
  • 55555

$(function(){

$('#wish').wish();

$('.wish').draggable({containment:'#wish',scroll:false});

});

注意:

jqueryui 需要加载 draggable 和 scale Effect,draggable 是支持拖拽,而 scale Effect 是点击关闭的效果。

以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!

相关推荐:

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
HTML新年许愿墙代码: ```html <!DOCTYPE html> <html> <head> <title>新年许愿墙</title> </head> <body> <h1>新年许愿墙</h1> <form> <input type="text" id="wish" placeholder="输入你的新年愿望"> <button type="button" onclick="makeWish()">许愿</button> </form> <ul id="wishList"> <!-- 这里将显示许愿列表 --> </ul> <script> function makeWish() { var wish = document.getElementById("wish").value; var wishList = document.getElementById("wishList"); var li = document.createElement("li"); li.appendChild(document.createTextNode(wish)); wishList.appendChild(li); } </script> </body> </html> ``` 网页版春节许愿墙代码: ```html <!DOCTYPE html> <html> <head> <title>春节许愿墙</title> </head> <body> <h1>春节许愿墙</h1> <form> <input type="text" id="wish" placeholder="输入你的春节愿望"> <button type="button" onclick="makeWish()">许愿</button> </form> <ul id="wishList"> <!-- 这里将显示许愿列表 --> </ul> <script> function makeWish() { var wish = document.getElementById("wish").value; var wishList = document.getElementById("wishList"); var li = document.createElement("li"); li.appendChild(document.createTextNode(wish)); wishList.appendChild(li); } </script> </body> </html> ``` 龙年许愿墙代码: ```html <!DOCTYPE html> <html> <head> <title>龙年许愿墙</title> </head> <body> <h1>龙年许愿墙</h1> <form> <input type="text" id="wish" placeholder="输入你的龙年愿望"> <button type="button" onclick="makeWish()">许愿</button> </form> <ul id="wishList"> <!-- 这里将显示许愿列表 --> </ul> <script> function makeWish() { var wish = document.getElementById("wish").value; var wishList = document.getElementById("wishList"); var li = document.createElement("li"); li.appendChild(document.createTextNode(wish)); wishList.appendChild(li); } </script> </body> </html> ``` 以上是三个不同主题的许愿墙HTML代码,用户可以在输入框中输入自己的许愿,点击“许愿”按钮后,许愿内容会以列表的形式显示出来。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值