jQuery常用方法和練習(xí)例子

要點:

? ? 1匣沼、jQuery方法內(nèi)置循環(huán):

? ? ? ? ? ? $('div').css('backgroundColor','red'):給所有DIV標(biāo)簽添加紅色背景

? ? 2、this出現(xiàn)在jQuery的function中浸船,代表循環(huán)時玫锋,當(dāng)前正在處理的DOM對象

? ? 3滓走、$(this),把當(dāng)前DOM對象轉(zhuǎn)換在JQuery迫肖,以便使用jQuery方法

? ? 4锅劝、隱式條件判斷語句:

? ? ? ? ? ? ? ? var result=條件表達(dá)式?真返回值:假返回值;

? ? 5、each(function) 對象的每個元素都做操作蟆湖。

? ? 收藏:jQuery樣式故爵。https://www.layui.com/demo/rate.html

常用方法:

? ? 1、篩選器:

? ? next('篩選條件')? ? 當(dāng)前的下一個

? ? nextAll('篩選條件')? ? 當(dāng)前的后面所有

? ? nextUntil('篩選條件')? ? 從下一個隅津,到滿足'篩選條件'的前一個標(biāo)簽诬垂,

? ? prev('篩選條件')? ? 當(dāng)前的上一個

? ? prevAll('篩選條件')? ? 當(dāng)前位置前面的所有同級標(biāo)簽

? ? prevUntil('篩選條件')? ? 從上一個,到滿足‘篩選條件’的前一個標(biāo)簽

? ? parent('篩選條件')? ? 父標(biāo)簽

? ? parents('篩選條件')? ? 向上一直找伦仍,直到html

? ? parentsUntil('篩選條件')? ? 向上一直找到'滿足篩選條件的標(biāo)簽'

? ? children('篩選條件')? ? 子標(biāo)簽

? ? siblings('篩選條件')? ? 除自已外结窘,其它兄弟標(biāo)簽

? ? find('篩選條件')? ? ? ? 遍歷自已包含的所有標(biāo)簽,找到‘符合條件的所有標(biāo)簽’

? ? first()? ? ? ? ? ? ? ? ? ? 結(jié)果里的第一個

? ? last()? ? ? ? ? ? ? ? ? ? 結(jié)果里的最后一個

? ? eq(數(shù)值)/ eq('數(shù)值')? ? ? ? 結(jié)果的表列里充蓝,第幾個值

? ? 2隧枫、內(nèi)容方法:

? ? ? ? text()? ? 取值/賦值喉磁,無參數(shù),獲取文本內(nèi)容官脓;text('this a text'),賦值

? ? ? ? html()? ? 取值/賦值协怒,無參數(shù),獲取文本內(nèi)容卑笨;text('<p>this is a html</p>'),賦值

? ? ? ? val()? ? ? input標(biāo)簽孕暇,取值/賦值,無參數(shù)赤兴,獲取value妖滔;val('value新值'),賦值。jQuery版本3以前桶良,checkbox和radio會出現(xiàn)不同步座舍,必須使用prop? ? ? ?

? ? ? ? prop(屬性,值)? ? 設(shè)置或返回被選元素的屬性和值艺普。使用字典同時多值簸州,設(shè)置:prop('checked','checked'),獲取屬性值:prop('checked')歧譬,結(jié)果undefine,代表沒有此屬性搏存。

? ? ? ? attr(屬性瑰步,值)? ? ? 設(shè)置被選元素的屬性和值¤得撸可以接受字典值缩焦。

? ? ? ? prop與attr區(qū)別:prop? 對于HTML元素本身就帶有的固有屬性? attr? 對于HTML元素我們自定義的加在標(biāo)簽中的屬性。?

? ? ? ? 具有 true 和 false 兩個屬性的屬性责静,如 checked, selected 或者 disabled 使用prop()


? ? $("img").attr("width",function(n,v){? ? ? ? \\n當(dāng)前對象在篩選器里的索引袁滥,v是獲取到width的值。

? ? ? return v-50;

? ? });


? ? <img src='https://static2.51cto.com/51cto/cms/homepage/2015/images/logo.gif' width='500px' />


? ? 3灾螃、樣式方法:

? ? ? ? hasClass('樣式名')? ? ? ? ? ? 判斷是否包含樣式名

? ? ? ? addClass('樣式名'):? ? ? ? ? 添加calss樣式

? ? ? ? removeClass('樣式名'):? ? 刪除class樣式

? ? ? ? toggleClass('樣式名'):? ? 不存在則添加题翻,存在則刪除


? ? 4、文檔處理:

? ? ? ? append(htmlstring) :在指定標(biāo)簽內(nèi)部的最后添加內(nèi)容

? ? ? ? prepend(htmlstring):在指定標(biāo)簽內(nèi)部的最前面添加內(nèi)容

? ? ? ? after(htmlstring):在指定標(biāo)簽結(jié)束符后腰鬼,外面添加

? ? ? ? before(htmlstring):在指定標(biāo)簽開始符前嵌赠,外面添加

? ? ? ? remove():刪除當(dāng)前元素

? ? ? ? empty():清空所有子元素

? ? ? ? clone():返回復(fù)制的元素html

? ? ? //添加

? ? ? $('#s1').click(function(){

? ? ? ? var s='<li>我是新來的</li>';

? ? ? ? $('#uli').after(s)

? ? ? })

? ? ? //remove()

? ? ? $('#r1').click(function(){

? ? ? $('#uli').remove();)}


? ? ? //empty();清空所有子元素

? ? $('#e1').click(function(){

? ? ? $('#uli').empty();

? ? })

? ? //clone,復(fù)制id=uli的元素熄赡,并追加到body

? ? $('body').append($('#uli').clone())

? ? 5姜挺、鼠標(biāo)坐標(biāo)

? ? ? ? scrollTop(值) 設(shè)置/獲取當(dāng)前對象的滾動條上下位置。

? ? ? ? scrollLeft(值) 設(shè)置/獲取當(dāng)前對象的滾動務(wù)左右位置彼硫。


? ? ? ? offset().left? ? 獲取元素左上角的當(dāng)前X坐標(biāo)

? ? ? ? offset().top? ? 獲取元素左上角的當(dāng)前Y坐標(biāo)

? ? ? ? offset({left:0,top:0})? ? ? ? 設(shè)置當(dāng)前元素的坐標(biāo)

? ? ? ? event.x? ? 獲取鼠標(biāo)當(dāng)前X坐標(biāo)

? ? ? ? event.y? ? 獲取鼠標(biāo)當(dāng)前Y坐標(biāo)

? ? ? $(document.body).mousemove(function(){

? ? ? ? $('#xx').text(event.x);

? ? ? ? $('#yy').text(event.y);

? ? ? })


? ? ? $('#divmove').offset({left:100,top:100})

? ? 6炊豪、jQuery綁定四種事件凌箕。

? ? ? ? 直接綁定:.click

? ? ? ? bind綁定:

? ? ? ? ? ? $('c1').bind('click',function(){....})

? ? ? ? delegate/undelegate綁定:在jQuery1.7中 .delegate()已被.on()取代

? ? ? ? ? ? $('c1').delegate('a','click',function(){ .... })

? ? ? ? ? ? $( elements ).delegate( selector, events, data, handler );

? ? ? ? on/off綁定

? ? ? ? ? ? $( elements ).on( events, [selector], data, handler );

? ? ? ? ? ? $('c1').on('click',function (){...})

<style>

? ? .d1{

? ? ? ? height:300px;

? ? ? ? width:300px;

? ? ? ? border:1px solid sandybrown;

? ? }

? ? .d2{

? ? ? ? height:200px;

? ? ? ? width:200px;

? ? ? ? margin:40px 40px;

? ? ? ? border:1px solid rebeccapurple;

? ? }

</style>

<div class="d1">

? ? <div class="d2">

? ? ? ? <span>lala</span>

? ? </div>

</div>

<script>

? ? $('.d1').on('click','span',function(){

? ? ? ? alert($(this).text())

? ? })

</script>

? ? 7、元素高度和寬度:

? ? ? ? image.png

? ? ? ? height/width:獲取/設(shè)置元素高度/寬度-內(nèi)容高词渤、寬

? ? ? ? innerHeight/innerWidth:獲取/設(shè)置元素高度/寬度-內(nèi)容高\寬+padding

? ? ? ? outerHeight/outerWidth:獲取/設(shè)置元素高度/寬度-內(nèi)容高\寬+padding+border

? ? ? ? outerHeight(true)/outerWidth(true):獲取/設(shè)置元素高度/寬度-內(nèi)容高\寬+padding+border+margin

<style>

? ? #out{

? ? ? ? height:300px;

? ? ? ? width:300px;

? ? ? ? border:10px solid darkred;

? ? ? ? padding:20px;

? ? }

? ? #in{

? ? ? ? height:100px;

? ? ? ? width:100px;

? ? ? ? border:10px solid rebeccapurple;

? ? ? ? padding:5px;

? ? ? ? margin-top:30px;

? ? }

</style>

<div id="out">

? ? <div id="in">

? ? ? ? <span id="nei">

? ? ? ? ? ? lalalalala

? ? ? ? </span>

? ? </div>

</div>

<script>

? ? var height_in=$('#in').width();

? ? t="height:"+height_in+'<br>';

? ? height_in=$('#in').innerWidth();

? ? t=t+"height:"+height_in+'<br>';

? ? height_in=$('#in').outerHeight();

? ? t=t+"height:"+height_in+'<br>';

? ? height_in=$('#in').outerHeight(true);

? ? t=t+"height:"+height_in+'<br>';

? ? $('#nei').html(t);

</script>

? ? ? ? 8牵舱、return false阻止事件發(fā)生

? ? ? ? ? ? 以下程序,不跳轉(zhuǎn)到href這個網(wǎng)址

<div class="d1">

? ? <div class="d2">

? ? ? ? <a onclick="return doNot()" >lala</a>

? ? </div>

</div>

<script>

? ? function doNot(){

? ? ? ? alert($('a').text());

? ? ? ? return false;

? ? }

</script>

? ? ? ? 9掖肋、jquery擴展

? ? ? ? ? ? .extend

? ? ? ? ? ? .fn.extend

1仆葡、左側(cè)彈出菜單,點擊出現(xiàn)子菜單志笼,其它隱藏

? ? HTML

? <div id='f1'>

? ? <div id='m1' class='bg'>菜單一</div>

? ? ? <ul>

? ? ? ? <li>sub11</li>

? ? ? ? <li>sub12</li>

? ? ? ? <li>sub13</li>

? ? ? </ul>

? ? <div id='m2' class='bg'>菜單二</div>

? ? ? <ul>

? ? ? ? <li>sub21</li>

? ? ? ? <li>sub22</li>

? ? ? ? <li>sub23</li>

? ? ? </ul>

? ? <div id='m3' class='bg'>菜單三</div>

? ? ? <ul>

? ? ? ? <li>sub31</li>

? ? ? ? <li>sub32</li>

? ? ? ? <li>sub33</li>

? ? ? </ul>

? </div>

? ? jQuery:

? <script>

? ? $(document).ready(function (){$('.bg').next().hide()});? ? ? ? ? ? ? ? ? ? //文檔加載完隱藏所有標(biāo)簽

? ? $('.bg').click(function(){$(this).next().toggle().siblings('ul').hide()}) //點擊展開沿盅,再點隱藏效果,鏈?zhǔn)骄幊獭?/p>

? </script>

2纫溃、彈出窗口,窗口其它元素不可操作腰涧。點叉關(guān)閉

? ? CSS樣式

? ? .header-menu{

? ? ? display:inline-block;

? ? ? margin-right:20px;

? ? ? height:40px;

? ? }

? ? .zhezhao{

? ? ? display:none;

? ? ? position:fixed;

? ? ? left:0;

? ? ? top:0;

? ? ? right:0;

? ? ? bottom:0;

? ? ? background-color:gray;

? ? ? z-index:8;

? ? ? opacity:0.7;

? ? }

? ? .regedit{

? ? ? display:none;

? ? ? width:400px;

? ? ? height:600px;

? ? ? position:fixed;

? ? ? background:white;

? ? ? left:50%;

? ? ? top:50%;

? ? ? margin-left:-200px;

? ? ? margin-top:-300px;

? ? ? z-index:9;

? ? }

? ? .login{

? ? ? display:none;

? ? ? width:400px;

? ? ? height:400px;

? ? ? position:fixed;

? ? ? background:white;

? ? ? left:50%;

? ? ? top:50%;

? ? ? margin-left:-200px;

? ? ? margin-top:-300px;

? ? ? z-index:9;

? ? }

? ? .divouter{

? ? ? width:100%;

? ? ? background:gray;

? ? ? text-align:right;

? ? }

? ? .close_flag{

? ? ? padding-right:10px;

? ? ? padding-top:10px;

? ? ? width:30px;

? ? }

? ? .show{

? ? ? display:block;

? ? }

? ? HTML



? <!--頭部banner!-->

? <div class='header'>

? ? <span id='regedit' name='regedit' class='header-menu'>注冊</span>

? ? <span id='login'? name='login' class='header-menu'>登陸</span>

? </div>

? <!--遮罩!-->

? <div class='zhezhao'></div>

? <!--注冊框-->

? <div class='regedit'>

? ? <div class='divouter'>

? ? ? <span id='hide' name='regedit' class='close_flag'>?<span>

? ? </div>

? </div>

? <!--login登陸框!divouter定位X,span樣式-->

? <div class='login'>

? ? <div class='divouter'>?

? ? ? <span id='hide' name='login' class='close_flag'>?<span>

? ? </div>

? </div>

? ? jQuery

? ? //顯示注冊/登陸框

? ? $('.header-menu').click(function(){

? ? ? $('.zhezhao').addClass('show');

? ? ? var sh = $(this).attr('name');? ? ? ? //使用獲取到的屬性值進(jìn)行二次定位紊浩,達(dá)到動態(tài)效果窖铡。

? ? ? var s='.'+sh;

? ? ? $(s).addClass('show');? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

? ? })

? ? //關(guān)閉顯示/登陸框

? ? $('.close_flag').click(function(){

? ? ? $('.zhezhao').removeClass('show');

? ? ? var hi=$(this).attr('name');

? ? ? var h='.'+hi;

? ? ? $(h).removeClass('show');

? ? })

3、鼠標(biāo)移入和移出背景變色:

? ? HTML:

? <style>

? ? .header{

? ? ? background-color:#1c97f5;

? ? ? height:40px;

? ? ? width:100%;

? ? ? min-width:960px;

? ? ? margin:0 auto;

? ? ? line-height:40px;

? ? ? text-align:right;

? ? }

? ? .header-menu{

? ? ? display:inline-block;

? ? ? margin-right:20px;

? ? ? height:40px;

? ? }

? </style>

? <div class='header'>

? ? <span class='header-menu'>注冊</span>

? ? <span class='header-menu'>登陸</span>

? </div>

? ? jQuery:

? ? $('.header-menu').mouseover(function(i,v){$(this).css({'backgroundColor':'#2550aa','color':'white'})})

? ? $('.header-menu').mouseout(function(i,v){$(this).css({'backgroundColor':'','color':''})})

4坊谁、TAB式菜單:

? ? HTML

? <style>

? ? .tab_div{

? ? ? background:gray;

? ? ? height:30px;

? ? ? width:100%;


? ? }

? ? .tab_div span{

? ? ? color:white;

? ? ? line-height:30px;

? ? ? display:inline-block;

? ? ? height:30px;

? ? ? padding-right:10px;

? ? ? padding-left:10px;

? ? }

? ? .tab_content{

? ? ? display:none;

? ? ? position:absolute;

? ? ? background:#dde0e3;

? ? ? width:100%;

? ? ? top:52px;

? ? ? bottom:0px;

? ? }

? ? .tab_over{

? ? ? background-color:#4e5154;

? ? }


</style>

? ? <div class='tab_div'><span id='t1'>標(biāo)簽一</span><span id='t2'>標(biāo)簽二</span><span id='t3'>標(biāo)簽三</span>

? ? </div>

? ? <div id='tab_content'>

? ? ? <div name='t1' class='tab_content'>111111</div>

? ? ? <div name='t2' class='tab_content'>2222222</div>

? ? ? <div name='t3' class='tab_content'>333333</div>

? ? </div>

? ? jQuery

? ? //tab菜單腳本费彼,實現(xiàn)方法千千萬~這里沒有選擇Addclass,因為class有前后定義的毛病~


? ? ? $("[name='t1']").show()

? ? ? $('.tab_div').children().mouseover(function(){

? ? ? ? $(this).addClass('tab_over').siblings().removeClass('tab_over');

? ? ? ? var d=$(this).addClass('tab_over').attr('id');

? ? ? ? var n = "[name='"+d+"']"

? ? ? ? $(n).show().siblings().each(function(){

? ? ? ? ? $(this).hide()

? ? ? ? })

? ? ? });

? ? //方案二:可以刪除子菜單ID口芍,省代碼~更簡潔~

? ? ? $(document).ready(function(){

? ? ? ? $(".tab_div").children().mouseover(function(i){

? ? ? ? ? $(this).addClass('tab_over').siblings().removeClass('tab_over');

? ? ? ? ? $('.tab_content').eq($(this).index()).show().siblings().hide();

? ? ? ? })

? ? ? })

5箍铲、點贊動態(tài)效果

? ? html:

<style>

? ? #zan{

? ? position: relative;

? ? width: 30px;

? ? cursor:pointer;

? ? }

? ? .jiayi{

? ? ? ? ? color:red;

? ? ? ? ? position:absolute;

? ? ? ? }

</style>

<br><br><br><br><br><br><br><br><br><br>

<div id="zan">贊</div>

? ? jQuery:

<script src="jquery-1.12.4.js"></script>

<script>

? ? $(document).ready(function () {

? ? ? ? $('#zan').click(function(){

? ? ? ? ? ? var font_size=14;

? ? ? ? ? ? var top=0;

? ? ? ? ? ? var right=0;

? ? ? ? ? ? var opacity=1;

? ? ? ? ? ? var ta=document.createElement('span');

? ? ? ? ? ? ? ? ? ? ? ? $(ta).addClass('jiayi');

? ? ? ? ? ? $(ta).css('font-size',font_size+'px');

? ? ? ? ? ? $(ta).css('top',top+'px');

? ? ? ? ? ? $(ta).css('right',right+'px');

? ? ? ? ? ? $(ta).css('opacity',opacity);

? ? ? ? ? ? $(ta).text('+1');

? ? ? ? ? ? $(this).append(ta);

? ? ? ? ? ? var inter=setInterval(function(){

? ? ? ? ? ? ? ? font_size+=1;

? ? ? ? ? ? ? ? top-=2;

? ? ? ? ? ? ? ? right-=2;

? ? ? ? ? ? ? ? opacity-=0.1;

? ? ? ? ? ? ? ? $(ta).css('font-size',font_size+'px');

? ? ? ? ? ? ? ? $(ta).css('top',top+'px');

? ? ? ? ? ? ? ? $(ta).css('right',right+'px');

? ? ? ? ? ? ? ? $(ta).css('opacity',opacity);

? ? ? ? ? ? ? ? if (opacity<0){

? ? ? ? ? ? ? ? ? ? $(ta).remove();

? ? ? ? ? ? ? ? ? ? clearInterval(inter);

? ? ? ? ? ? ? ? }

? ? ? ? ? ? },20)

? ? ? ? });

? ? })

</script>

6、注冊框判斷是否為空鬓椭,為空返回并提示:

? ? ? ? 本質(zhì)是用return跳出函數(shù)颠猴,并給標(biāo)簽返回一個False。

? ? ? ? HTML

<div class='header'>

? <span id='regedit' name='regedit' class='header-menu'>注冊</span>

? <span id='login'? name='login' class='header-menu'>登陸</span>

</div>

<div class='zhezhao'></div>

? <div class='regedit'>

? ? <div class='divouter'>

? ? <span id='hide' name='regedit' class='close_flag'>?</span>

? </div>

? <div>

? ? ? <table >

? ? ? ? ? <tbody id="reg_tb">

? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? <td>用戶名:</td>

? ? ? ? ? ? ? ? ? <td><input type="text"/></td>

? ? ? ? ? ? ? ? ? <td></td>

? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? <td>密碼:</td>

? ? ? ? ? ? ? ? ? <td><input type="text"/></td>

? ? ? ? ? ? ? ? ? <td></td>

? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? <td>確認(rèn)密碼:</td>

? ? ? ? ? ? ? ? ? <td><input type="text"/></td>

? ? ? ? ? ? ? ? ? <td>111</td>

? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? <td>郵箱:</td>

? ? ? ? ? ? ? ? ? <td><input type="text"/></td>

? ? ? ? ? ? ? ? ? <td></td>

? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? <td>電話:</td>

? ? ? ? ? ? ? ? ? <td><input type="text"/></td>

? ? ? ? ? ? ? ? ? <td></td>

? ? ? ? ? ? ? </tr>

? ? ? ? ? ? ? <tr>

? ? ? ? ? ? ? ? ? <td>愛好:</td>

? ? ? ? ? ? ? ? ? <td><input type="text"/></td>

? ? ? ? ? ? ? ? ? <td></td>

? ? ? ? ? ? ? </tr>

? ? ? ? ? </tbody>

? ? ? </table>

? ? ? <div>

? ? ? ? ? <input type="button" id='submit' value="提交">

? ? ? ? ? <input type="button" id='cancel' value="重置">

? ? ? </div>

? </div>

</div>

<div class='login'>

? <div class='divouter'>

? ? <span id='hide' name='login' class='close_flag'>?</span>

? </div>

</div>

? ? ? ? CSS

.tab_div span{

? color:white;

? line-height:30px;

? display:inline-block;

? height:30px;

? padding-right:10px;

? padding-left:10px;

? background-color:#4e5154;

}

table{

? width:100%

}

.close_flag{

? padding-right:10px;

? padding-top:10px;

? width:30px;

}

.header-menu{

? display:inline-block;

? margin-right:20px;

? height:40px;

}

.zhezhao{

? display:none;

? position:fixed;

? left:0;

? top:0;

? right:0;

? bottom:0;

? background-color:gray;

? z-index:8;

? opacity:0.7;

}

.regedit{

? display:none;

? width:400px;

? height:600px;

? position:fixed;

? background:white;

? left:50%;

? top:50%;

? margin-left:-200px;

? margin-top:-300px;

? z-index:9;

}

.login{

? ? display:none;

? ? width:400px;

? ? height:400px;

? ? position:fixed;

? ? background:white;

? ? left:50%;

? ? top:50%;

? ? margin-left:-200px;

? ? margin-top:-300px;

? ? z-index:9;

}

.divouter{

? width:100%;

? background:gray;

? text-align:right;

}

.close_flag{

? padding-right:10px;

? padding-top:10px;

? width:30px;

}

? ? ? ? jQuery

<script>

? ? ($('#submit').click(function(){

? ? ? ? var flag=true;

? ? ? ? var dic=[];

? ? ? ? $('#reg_tb').children().each(function(){

? ? ? ? ? ? var input_box=$(this).children().eq(1).children().eq(0).val();

? ? ? ? ? ? console.log(input_box);

? ? ? ? ? ? if (input_box.length<=0) {

? ? ? ? ? ? ? ? flag = false;

? ? ? ? ? ? ? ? $(this).children().eq(2).html('<span style="color:red">*必填項</span>');

? ? ? ? ? ? ? ? return flag;

? ? ? ? ? ? }else{

? ? ? ? ? ? ? ? dic.push(input_box);

? ? ? ? ? ? ? ? $(this).children().eq(2).html('');

? ? ? ? ? ? }

? ? ? ? });

? ? ? ? if (flag){

? ? ? ? ? ? console.log(dic);

? ? ? ? }

? ? ? ? return flag;

? ? }));



? ? \\控制遮罩

$(document).ready(function (){$('.bg').next().hide()});? ? ? ? ? ? ? ? ? ? //文檔加載完隱藏所有標(biāo)簽

$('.bg').click(function(){$(this).next().toggle().siblings('ul').hide()}) //點擊展開小染,再點隱藏效果翘瓮,鏈?zhǔn)骄幊獭?/p>

$('.header-menu').mouseover(function(i,v){$(this).css({'backgroundColor':'#2550aa','color':'white'})})

$('.header-menu').mouseout(function(i,v){$(this).css({'backgroundColor':'','color':''})})

//顯示注冊/登陸框

$('.header-menu').click(function(){

? $('.zhezhao').addClass('show');

? var sh = $(this).attr('name');

? var s='.'+sh;

? $(s).addClass('show');

})

//關(guān)閉顯示/登陸框

$('.close_flag').click(function(){

? $('.zhezhao').removeClass('show');

? var hi=$(this).attr('name');

? var h='.'+hi;

? $(h).removeClass('show');

})

深圳網(wǎng)站建設(shè) www.sz886.com

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市裤翩,隨后出現(xiàn)的幾起案子资盅,更是在濱河造成了極大的恐慌,老刑警劉巖岛都,帶你破解...
    沈念sama閱讀 222,627評論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件律姨,死亡現(xiàn)場離奇詭異,居然都是意外死亡臼疫,警方通過查閱死者的電腦和手機择份,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,180評論 3 399
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來烫堤,“玉大人荣赶,你說我怎么就攤上這事凤价。” “怎么了拔创?”我有些...
    開封第一講書人閱讀 169,346評論 0 362
  • 文/不壞的土叔 我叫張陵利诺,是天一觀的道長。 經(jīng)常有香客問我剩燥,道長慢逾,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 60,097評論 1 300
  • 正文 為了忘掉前任灭红,我火速辦了婚禮侣滩,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘变擒。我一直安慰自己君珠,他們只是感情好,可當(dāng)我...
    茶點故事閱讀 69,100評論 6 398
  • 文/花漫 我一把揭開白布娇斑。 她就那樣靜靜地躺著策添,像睡著了一般。 火紅的嫁衣襯著肌膚如雪毫缆。 梳的紋絲不亂的頭發(fā)上唯竹,一...
    開封第一講書人閱讀 52,696評論 1 312
  • 那天,我揣著相機與錄音苦丁,去河邊找鬼摩窃。 笑死,一個胖子當(dāng)著我的面吹牛芬骄,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播鹦聪,決...
    沈念sama閱讀 41,165評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼账阻,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了泽本?” 一聲冷哼從身側(cè)響起淘太,我...
    開封第一講書人閱讀 40,108評論 0 277
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎规丽,沒想到半個月后蒲牧,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 46,646評論 1 319
  • 正文 獨居荒郊野嶺守林人離奇死亡赌莺,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,709評論 3 342
  • 正文 我和宋清朗相戀三年冰抢,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片艘狭。...
    茶點故事閱讀 40,861評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡挎扰,死狀恐怖翠订,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情遵倦,我是刑警寧澤尽超,帶...
    沈念sama閱讀 36,527評論 5 351
  • 正文 年R本政府宣布,位于F島的核電站梧躺,受9級特大地震影響似谁,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜掠哥,卻給世界環(huán)境...
    茶點故事閱讀 42,196評論 3 336
  • 文/蒙蒙 一巩踏、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧龙致,春花似錦蛀缝、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,698評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至榛了,卻和暖如春在讶,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背霜大。 一陣腳步聲響...
    開封第一講書人閱讀 33,804評論 1 274
  • 我被黑心中介騙來泰國打工构哺, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人战坤。 一個月前我還...
    沈念sama閱讀 49,287評論 3 379
  • 正文 我出身青樓曙强,卻偏偏與公主長得像,于是被迫代替她去往敵國和親途茫。 傳聞我的和親對象是個殘疾皇子碟嘴,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 45,860評論 2 361

推薦閱讀更多精彩內(nèi)容