欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于jquery DOM寫的類似微博發(fā)布的效果

 更新時(shí)間:2012年10月20日 02:25:36   作者:  
看了上個(gè)原生js DOM版的微博發(fā)布的效果,再來看看如何用jq寫??赐甏a,就會(huì)發(fā)現(xiàn)jq的強(qiáng)大,用更少的代碼寫更多的效果
復(fù)制代碼 代碼如下:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>微博發(fā)布jq版</title>
<meta name="Keywords" content="">
<meta name="Description" content="">
<script src="http://code.jquery.com/jquery-1.8.0.min.js" type="text/javascript"></script>
<style type="text/css">
/*重置{*/
html{color:#000;background:#fff;}
body,div,ul,li,h1,input,button,textarea{padding:0;margin:0;}
img{border:0;}
li{list-style:none;}
/*}重置*/
h1{margin:20px auto 0;font-size:30px;width:200px;text-align:center;color:blue;}
#outer{position:relative;width:400px;margin:auto;margin:20px auto 10px;}
#test1{display:block;width:400px;height:70px;}
.error{background:#f00;width:400px;height:50px;position:absolute;left:1px;top:10px;opacity:0.6;filter:alpha(opacity=60);}
#test2{display:block;margin-left:800px;width:60px;height:30px;font-size:20px;}
.test3{margin:10px auto;width:400px;}
#test3{border:1px #444 solid;width:400px;min-height:300px;_height:300px;padding-bottom:10px;color:blue;float:left;}
.test{border-bottom:1px blue dotted;width:383px;padding:10px 5px 5px 10px;float:left;}
.inf{margin-top:15px;float:right;color:#555;}
.con{margin-left:16px;display:inline;width:304px;float:left;word-break:break-all;}
.bu{margin-left:6px;display:inline;}
.imgs{width:60px;height:60px;float:left;}
.imgInf{width:120px;background:#f0f;color:#fff;position:absolute;z-index:2;left:-65px;top:62px;opacity:0.5;filter:alpha(opacity=50);}
.finish{background:green;width:300px;height:50px;color:#ff0;font-size:30px;text-align:center;line-height:50px;position:absolute;left:50px;top:10px;opacity:0.6;filter:alpha(opacity=60);}
.imgOut{position:relative;}

</style>
</head>
<body>
<h1>微博發(fā)布</h1>
<div id="outer">
<textarea id="test1" ></textarea>
</div>
<input type="button" id="test2" value="發(fā)布"/>
<div class="test3"><div id="test3"></div></div>

<script type="text/javascript">
<!--
$('#test2').click(function(){ //點(diǎn)擊發(fā)布的事件
if($('#test1')[0].value==""){
var finish=$('<div class="error"></div>').appendTo($('#outer')).hide().fadeIn(200).fadeOut(200).fadeIn(200).fadeOut(200);
return;
}else{
$('#test2')[0].disabled=true; //發(fā)布成功后,禁止
var timer=new Date();
//微博
$('<div class="test"><span class="imgOut"><img src="images/wukong.gif" class="imgs"/></span><div class="con"></div><div class="inf">'+timer.getHours()+"時(shí)"+timer.getMinutes()+"分"+timer.getSeconds()+"秒"+'<input type="button" value="刪除" class="bu"/></div></div>').prependTo($('#test3'));
$('.con')[0].innerText=$('#test1')[0].value;
//頭像信息
$('.imgs:eq(0)').hover(
function(){$('<ul class="imgInf"><li>名字:悟空</li><li>稱號(hào):戰(zhàn)斗圣佛</li><li>現(xiàn)居:花果山</li></ul>').appendTo($(this).parent());},
function(){$('.imgInf').remove();}
)
//清空
$('#test1')[0].value="";
//發(fā)布成功時(shí)動(dòng)畫
$('<div class="finish">發(fā)布成功</div>').appendTo($('#outer')).hide().fadeIn(500).fadeOut(500,function(){$('#test2')[0].disabled=false;});
//插入節(jié)點(diǎn)時(shí)的動(dòng)畫效果
$('.test:first').hide().slideDown("slow");
//刪除按鈕的事件
$('.bu:eq(0)').click(function(){
if(confirm('確定刪除嗎?')){
$(this).parent().parent().hide(1000,function(){
$(this).remove();
});
}
});
}
})
//-->
</script>
</body>
</html>

相關(guān)文章

  • jQuery focus和blur事件的應(yīng)用詳解

    jQuery focus和blur事件的應(yīng)用詳解

    本篇文章主要是對(duì)jQuery中focus和blur事件的應(yīng)用進(jìn)行了介紹,需要的朋友可以過來參考下,希望對(duì)大家有所幫助
    2014-01-01
  • JQuery ztree帶篩選、異步加載實(shí)例講解

    JQuery ztree帶篩選、異步加載實(shí)例講解

    這篇文章主要為大家詳細(xì)介紹了JQuery ztree帶篩選、異步加載實(shí)例,zTree支持靜態(tài) 和 Ajax 異步加載節(jié)點(diǎn)數(shù)據(jù),并支持極其靈活的checkbox或radio選擇功能,本文為大家進(jìn)行具體介紹
    2016-02-02
  • jquery+css實(shí)現(xiàn)動(dòng)感的圖片切換效果

    jquery+css實(shí)現(xiàn)動(dòng)感的圖片切換效果

    這篇文章主要介紹了jquery+css實(shí)現(xiàn)動(dòng)感的圖片切換效果,效果實(shí)現(xiàn)很精致,動(dòng)畫簡(jiǎn)潔大方,推薦給大家,感興趣的小伙伴們可以參考一下
    2015-11-11
  • 詳解jQuery中基本的動(dòng)畫方法

    詳解jQuery中基本的動(dòng)畫方法

    通過jQuery中基本的動(dòng)畫方法,能夠輕松地為網(wǎng)頁添加非常精彩的視覺效果,給用戶一種全新的體驗(yàn),本文主要對(duì)jQuery中基本的動(dòng)畫方法進(jìn)行詳細(xì)介紹,需要的朋友一起來看下吧
    2016-12-12
  • jquery UI Datepicker時(shí)間控件的使用方法(加強(qiáng)版)

    jquery UI Datepicker時(shí)間控件的使用方法(加強(qiáng)版)

    這篇文章繼續(xù)介紹了jquery UI Datepicker時(shí)間控件的使用方法,主要關(guān)于Datepicker插件的介紹和使用,并分享了第一個(gè)日歷插件的使用實(shí)例,需要的朋友可以參考下
    2015-11-11
  • jQuery-mobile事件監(jiān)聽與用法詳解

    jQuery-mobile事件監(jiān)聽與用法詳解

    這篇文章主要介紹了jQuery-mobile事件監(jiān)聽與用法,結(jié)合實(shí)例形式分析了jQuery-mobile各種常見事件類型與使用技巧,需要的朋友可以參考下
    2016-11-11
  • jquery插件懶加載的示例

    jquery插件懶加載的示例

    這篇文章主要介紹了jquery插件懶加載的示例,幫助大家更好的利用jQuery制作網(wǎng)頁,感興趣的朋友可以了解下
    2020-10-10
  • jQuery獲取動(dòng)態(tài)生成的元素示例

    jQuery獲取動(dòng)態(tài)生成的元素示例

    頁面上可以動(dòng)態(tài)添加數(shù)據(jù),比如table,點(diǎn)擊按鈕可以動(dòng)態(tài)添加行,下面與大家分享下jQuery如何獲取動(dòng)態(tài)生成的元素
    2014-06-06
  • 使用js顯示當(dāng)前時(shí)間示例

    使用js顯示當(dāng)前時(shí)間示例

    這篇文章主要介紹了使用js顯示當(dāng)前時(shí)間示例,這里也用到了jquery,讓得把它也要引入到頁面中
    2014-03-03
  • jquery無刷新驗(yàn)證郵箱地址實(shí)現(xiàn)實(shí)例

    jquery無刷新驗(yàn)證郵箱地址實(shí)現(xiàn)實(shí)例

    原理非常的簡(jiǎn)單在用戶輸入郵箱離開之后我們通用jquery ajax發(fā)送數(shù)據(jù)給mail.php文件,然后由它實(shí)現(xiàn)查找此郵箱是不是在數(shù)據(jù)庫中然后反饋對(duì)應(yīng)信息即可
    2014-02-02

最新評(píng)論