jQuery基于ajax實(shí)現(xiàn)帶動(dòng)畫(huà)效果無(wú)刷新柱狀圖投票代碼
本文實(shí)例講述了jQuery基于ajax實(shí)現(xiàn)帶動(dòng)畫(huà)效果無(wú)刷新柱狀圖投票代碼。分享給大家供大家參考。具體如下:
這里介紹的jQuery ajax投票特效,帶動(dòng)畫(huà)效果 類(lèi)似進(jìn)度條風(fēng)格的柱狀圖,以你最喜歡的編程語(yǔ)言是哪一種為例來(lái)演示投票效果,以Ajax方式無(wú)刷新投票,每點(diǎn)擊一次,橫向的柱狀圖就會(huì)增長(zhǎng)一節(jié)。如果在火狐或chrome下瀏覽,那些柱狀圖橫條是圓角的,在IE8下則無(wú)此效果。
運(yùn)行效果截圖如下:
具體代碼如下:
<!DOCTYPE html> <html> <head> <title>jQuery ajax投票特效,帶動(dòng)畫(huà)效果 柱狀圖</title> <script type="text/javascript" src="jquery-1.6.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#container div a").click(function() { $(this).parent().animate({ width: '+=100px' }, 500); $(this).prev().html(parseInt($(this).prev().html()) + 1); return false; }); }); </script> <style type="text/css"> * { font-family: Arial, "Free Sans"; } #container { margin-top: 20px; color: #fff; } #container #question { display: block; padding: 20px; font-weight: bold; letter-spacing: -3px; margin-bottom: 20px; padding: 10px; font-size: 40px; } #container div { font-weight: bold; letter-spacing: -3px; background: #0099cc; margin-bottom: 15px; padding: 10px; font-size: 34px; color: #ffffff; border-left: 20px solid #333; width: 400px; -webkit-border-radius: 0.5em; -moz-border-radius: 0 0.5em 0.5em 0; border-radius: 0 1.5em 1.5em 0; } #container div a { border-radius: 0.3em; text-decoration: none; color: #0099cc; padding: 5px 15px; background: #333; margin: 0 20px; } #container div a:hover { color: #fff; } #main { background: #0099cc; margin-top: 0; padding: 2px 0 4px 0; text-align: center; } #main a { color: #ffffff; text-decoration: none; font-size: 12px; font-weight: bold; font-family: Arial; } #main a:hover { text-decoration: underline; } body { margin: 0; padding: 0; background: #ffffff url('//img.jbzj.com/file_images/article/201508/2015810110844109.gif') repeat right top; } #text { margin: 0 auto; width: 500px; font-size: 12px; color: #0099cc; font-weight: bold; text-align: center; margin-top: 20px; } </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head> <body> <div id="container"> <span id="question">你最喜歡的編程語(yǔ)言是哪一種?</span> <div><span>0</span><a href="">投票</a>PHP</div> <div><span>0</span><a href="">投票</a>Ruby</div> <div><span>0</span><a href="">投票</a>Java</div> <div><span>0</span><a href="">投票</a>ASP</div> <div><span>0</span><a href="">投票</a>Perl</div> <div><span>0</span><a href="">投票</a>ColdFusion</div> </div> </body> </html>
希望本文所述對(duì)大家的jquery程序設(shè)計(jì)有所幫助。
- PHP+MySql+jQuery實(shí)現(xiàn)的"頂"和"踩"投票功能
- 基于jQuery實(shí)現(xiàn)仿搜狐辯論投票動(dòng)畫(huà)代碼(附源碼下載)
- jquery彩色投票進(jìn)度條簡(jiǎn)單實(shí)例演示
- 基于PHP+jQuery+MySql實(shí)現(xiàn)紅藍(lán)(頂踩)投票代碼
- PHP結(jié)合jQuery實(shí)現(xiàn)紅藍(lán)投票功能特效
- 基于jquery的多彩百分比 動(dòng)態(tài)進(jìn)度條 投票效果顯示效果實(shí)現(xiàn)代碼
- 基于jQuery的投票系統(tǒng)顯示結(jié)果插件
- 基于Jquery與WebMethod投票功能實(shí)現(xiàn)代碼
- 基于jquery實(shí)現(xiàn)彩色投票進(jìn)度條代碼解析
相關(guān)文章
JQuery中關(guān)于jquery.js與jquery.min.js的比較探討
jquery-1.4.2.min.js是優(yōu)化的,而query-1.4.2.js是易于開(kāi)發(fā)著閱讀的,具體詳解祥看本文,希望對(duì)你有所幫助2013-05-05jquery ajax的success回調(diào)函數(shù)中實(shí)現(xiàn)按鈕置灰倒計(jì)時(shí)
實(shí)現(xiàn)異步手機(jī)發(fā)送短信成功之后在ajax的success回調(diào)中實(shí)現(xiàn)將發(fā)送按鈕置灰并倒計(jì)時(shí),具體的實(shí)現(xiàn)示例如下,喜歡的朋友可以研究下2013-11-11Jquery循環(huán)截取字符串的方法(多出的字符串處理成"...")
下面小編就為大家?guī)?lái)一篇Jquery循環(huán)截取字符串的方法(多出的字符串處理成"...")。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-11-11juqery 學(xué)習(xí)之三 選擇器 簡(jiǎn)單 內(nèi)容
juqery 學(xué)習(xí)之三 選擇器 簡(jiǎn)單 內(nèi)容,學(xué)習(xí)jquery的朋友可以參考下。2010-11-11Jquery選擇器簡(jiǎn)明版?Jquery選擇器實(shí)用版
最近需要用jquery獲取一些dom數(shù)據(jù)的操作,發(fā)現(xiàn)jquery的選擇器非常強(qiáng)大,很方便進(jìn)行一些dom操作,下面就專(zhuān)門(mén)針對(duì)這塊內(nèi)容做個(gè)簡(jiǎn)單的介紹,需要的朋友可以參考下2023-05-05jQuery Validate表單驗(yàn)證入門(mén)學(xué)習(xí)
這篇文章主要介紹了jQuery Validate表單驗(yàn)證入門(mén)知識(shí),該插件捆綁了一套有用的驗(yàn)證方法,包括 URL 和電子郵件驗(yàn)證,同時(shí)提供了一個(gè)用來(lái)編寫(xiě)用戶(hù)自定義方法的 API,感興趣的小伙伴們可以參考一下2015-12-12jQuery實(shí)現(xiàn)html table行Tr的復(fù)制、刪除、計(jì)算功能
這篇文章主要介紹了jQuery實(shí)現(xiàn)html table行Tr的復(fù)制、刪除、計(jì)算功能,涉及jQuery針對(duì)table表格的常見(jiàn)復(fù)制、添加、刪除與計(jì)算行數(shù)等簡(jiǎn)單操作技巧,需要的朋友可以參考下2017-07-07