jQuery+css3實(shí)現(xiàn)Ajax點(diǎn)擊后動(dòng)態(tài)刪除功能的方法
本文實(shí)例講述了jQuery+css3實(shí)現(xiàn)Ajax點(diǎn)擊后動(dòng)態(tài)刪除功能的方法。分享給大家供大家參考。具體如下:
這里使用jquery實(shí)現(xiàn)ajax動(dòng)態(tài)刪除一個(gè)方框,并帶有動(dòng)畫緩沖效果,在google plus網(wǎng)站發(fā)現(xiàn)的特效,在此獻(xiàn)丑模仿了一番,已基本與Google Plusp功能相同,你可在方框中加入一些內(nèi)容,jquery插件選的版本是1.6.2,更高版本也是可以的。
運(yùn)行效果截圖如下:
具體代碼如下:
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jQuery+css3實(shí)現(xiàn)Ajax動(dòng)態(tài)點(diǎn)擊刪除功能</title> <script type="text/javascript" src="jquery-1.6.2.min.js"></script> <script type="text/javascript"> jQuery.easing['jswing'] = jQuery.easing['swing']; jQuery.extend( jQuery.easing, { def: 'easeOutQuad', swing: function (x, t, b, c, d) { return jQuery.easing[jQuery.easing.def](x, t, b, c, d); }, easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, easeInOutQuad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, easeInCubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, easeOutCubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, easeInOutCubic: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }, easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, easeOutQuart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, easeInOutQuart: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t + b; return -c/2 * ((t-=2)*t*t*t - 2) + b; }, easeInQuint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, easeOutQuint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, easeInOutQuint: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; }, easeInSine: function (x, t, b, c, d) { return -c * Math.cos(t/d * (Math.PI/2)) + c + b; }, easeOutSine: function (x, t, b, c, d) { return c * Math.sin(t/d * (Math.PI/2)) + b; }, easeInOutSine: function (x, t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }, easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; }, easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, easeInOutExpo: function (x, t, b, c, d) { if (t==0) return b; if (t==d) return b+c; if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; }, easeInCirc: function (x, t, b, c, d) { return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; }, easeOutCirc: function (x, t, b, c, d) { return c * Math.sqrt(1 - (t=t/d-1)*t) + b; }, easeInOutCirc: function (x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; }, easeInElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; }, easeOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; }, easeInOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; }, easeInBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*(t/=d)*t*((s+1)*t - s) + b; }, easeOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, easeInOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; }, easeInBounce: function (x, t, b, c, d) { return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; }, easeOutBounce: function (x, t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } }, easeInOutBounce: function (x, t, b, c, d) { if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; } }); </script> <script type="text/javascript"> $(document).ready(function() { $(".sqare").click(function() { $(this).animate({width:'100px',height:'100px'}, 500, 'linear', function() { $(this).addClass('circle-label-rotate'); }).addClass('circle').html('<div class="innertext">Bye</div>').animate({"opacity":"0","margin-left":"510px"},1500,function(){ }); $(this).slideUp({duration: 'slow',easing: 'easeOutBounce'}); }); }); </script> <style> .circle-label-rotate {-webkit-animation-name: rotateThis;-webkit-animation-duration:2s;-webkit-animation-iteration-count:infinite;-webkit-animation-timing-function:linear;} @-webkit-keyframes rotateThis {from {-webkit-transform:scale(1) rotate(0deg);} to{-webkit-transform:scale(1) rotate(360deg);}} .circle{border-radius: 50px;-moz-border-radius: 50px; -webkit-border-radius: 50px;height:100px;width:100px;background:#dedede;} .sqare{height:100px;width:500px;border:dashed 1px #000;margin-top:10px;} .innertext{padding:40px;} </style> </head> <body> <div> <div height="125px" align='center'> </div></div> <div style='width:600px;margin:0 auto'> <h4>請(qǐng)點(diǎn)擊虛線方框</h4> <div class="sqare"> </div> <div class="sqare">這個(gè)方框是可以被刪除的 </div> <div class="sqare"> </div> <div class="sqare"> </div> <div class="sqare"> </div> </div> </body> </html>
希望本文所述對(duì)大家的jquery程序設(shè)計(jì)有所幫助。
- jquery ajax實(shí)現(xiàn)批量刪除具體思路及代碼
- PHP jQuery+Ajax結(jié)合寫批量刪除功能
- PHP ajax+jQuery 實(shí)現(xiàn)批量刪除功能實(shí)例代碼小結(jié)
- JQuery+ajax實(shí)現(xiàn)批量上傳圖片(自寫)
- jQuery通過(guò)ajax快速批量提交表單數(shù)據(jù)
- JQuery DataTable刪除行后的頁(yè)面更新利用Ajax解決
- jQuery之a(chǎn)jax刪除詳解
- jQuery ajax中使用confirm,確認(rèn)是否刪除的簡(jiǎn)單實(shí)例
- 如何從jQuery的ajax請(qǐng)求中刪除X-Requested-With
- 基于php(Thinkphp)+jquery 實(shí)現(xiàn)ajax多選反選不選刪除數(shù)據(jù)功能
- jQuery+ajax實(shí)現(xiàn)批量刪除功能完整示例
相關(guān)文章
jQuery實(shí)現(xiàn)簡(jiǎn)單聊天室
這篇文章主要為大家詳細(xì)介紹了jQuery實(shí)現(xiàn)簡(jiǎn)單聊天室,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-02-02jquery實(shí)現(xiàn)網(wǎng)頁(yè)的頁(yè)面平滑滾動(dòng)效果代碼
這篇文章主要介紹了jquery實(shí)現(xiàn)網(wǎng)頁(yè)的頁(yè)面平滑滾動(dòng)效果代碼,涉及jQuery結(jié)合鼠標(biāo)事件操作頁(yè)面元素滾動(dòng)效果的實(shí)現(xiàn)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-11-11基于Datatables跳轉(zhuǎn)到指定頁(yè)的簡(jiǎn)單實(shí)例
下面小編就為大家?guī)?lái)一篇基于Datatables跳轉(zhuǎn)到指定頁(yè)的簡(jiǎn)單實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-11-11jQuery 借助插件Lavalamp實(shí)現(xiàn)導(dǎo)航條動(dòng)態(tài)美化效果
導(dǎo)航條動(dòng)態(tài)顯示效果借助插件Lavalamp可以輕松實(shí)現(xiàn),以前用animate來(lái)實(shí)現(xiàn),效果不是很好2013-09-09完美兼容各大瀏覽器的jQuery仿新浪圖文淡入淡出間歇滾動(dòng)特效
本文是作者學(xué)習(xí)jQuery之后練手之作,兼容各大瀏覽器,非常的精美實(shí)用,這里放出來(lái)給小伙伴們,有需要的直接拿走,別跟我客氣^_^2014-11-11jquery ajax對(duì)特殊字符進(jìn)行轉(zhuǎn)義防止js注入使用示例
如果有人在留言里寫入了js語(yǔ)句,這結(jié)語(yǔ)句都會(huì)被執(zhí)行.解決辦法就是對(duì)這些特殊字符進(jìn)行轉(zhuǎn)義再顯示出來(lái),下面有個(gè)不錯(cuò)的示例,感興趣的朋友可以參考下2013-11-11jquery 模式對(duì)話框終極版實(shí)現(xiàn)代碼
今天終于有時(shí)間把我以前寫的一個(gè)jQuery插件進(jìn)行整理,改進(jìn)。這是一個(gè)模擬“模式對(duì)話框”的插件,該模式對(duì)話框共有三種皮膚,紅、綠、藍(lán)。2009-09-09jQuery實(shí)現(xiàn)類似淘寶網(wǎng)圖片放大效果的方法
這篇文章主要介紹了jQuery實(shí)現(xiàn)類似淘寶網(wǎng)圖片放大效果的方法,實(shí)例分析了jquery實(shí)現(xiàn)圖片放大效果的方法,涉及jquery操作鼠標(biāo)事件及頁(yè)面元素屬性修改的相關(guān)技巧,需要的朋友可以參考下2015-07-07jQuery快速實(shí)現(xiàn)商品數(shù)量加減的方法
這篇文章主要介紹了 jQuery快速實(shí)現(xiàn)商品數(shù)量加減的方法,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-02-02