標籤:style blog http color io os ar strong sp
先簡單的介紹下功能點:
- 隨機顯示背景圖或背景色
- 出現的位置隨機
- 可以通過拖拽改變位置
<!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;} .s1 { background: url(s1.png); } .s2 { background: url(s2.png); } .s3 { background: url(s3.png); } .s4 { background: url(s4.png); } .s5 { background: url(s5.png); } </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(){ $(‘#wish‘).wish(); $(‘.wish‘).draggable({containment:‘#wish‘,scroll:false});});</script>
注意:
jqueryui 需要載入 draggable 和 scale Effect,draggable 是支援拖拽,而 scale Effect 是點擊關閉的效果。
點此此處下載檔案
Jquery 實現許願牆效果,可拖拽