欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

jquery切換div,jquery切換圖片代碼

怎樣利用jquery使得div之間進(jìn)行切換特效

用這個(gè)改一下好了

創(chuàng)新互聯(lián)專注于合作企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站設(shè)計(jì),商城網(wǎng)站建設(shè)。合作網(wǎng)站建設(shè)公司,為合作等地區(qū)提供建站服務(wù)。全流程按需策劃,專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)

html

head

meta http-equiv="Content-Type" content="text/html; charset=gb2312" /

meta name="Copyright" content="/" /

meta name="description" content="" /

meta content="" name="keywords" /

title懶人圖庫(kù)/title

/head

style type="text/css"

*{margin:3;padding:0;font-size:13px;}

body{

font-size:12px;

color:#333333;

text-align:center;

font-family:'宋體',arial,verdana,sans-serif;

margin-top: 8px;

}

body *{text-align:center;}

.font14{font-size:14px;}

select{font-family: Times New Roman,arial,verdana,sans-serif;}

table{ border-collapse:collapse;}

img{border:0;}

ul{list-style-type:none;}

.clear{clear: both;height:0;line-height:0px;font-size:14px;}

.center{text-align:center;}

.mleft0{margin-left:0px !important;}

.mtop0{margin-top:0px !important;}

.strong{font-weight: bold;}

.sb{color:#009A91;font-weight: bold;}

/*頭部*/

#i_photo_index{width:258px;height:256px;text-align:center;}

#i_photo_index a.i_photo_a{height:180px;text-align:center;margin-left:8px;}

#i_photo_index a.i_photo_a img{margin-top:10px;}

#i_photo_index h1{margin-top:0 !important;margin-top:4px;margin-top /**/:2px;height:28px;line-height:28px;text-align:center;}

#i_photo_index h1 a{font-size:18px;font-weight:normal;font-family:"黑體",arial,verdana,sans-serif;}

#i_photo_index p{width:96%;margin:0 2%;line-height:20px;text-align:left;text-indent:2em;}

#i_photo_index p span{margin-right:30px !important;margin-right /**/:0px;}

a:link {

color: #333333;

text-decoration: none;

}

a:visited {

color: #333333;

text-decoration: none;

}

a:hover {

color: #FF6600;

text-decoration: underline;

}

/style

style type="text/css"

.jdt {

border: 1px solid #CCCCCC;

}

#i_photo img{margin-left:0px;}

.i_link2 a{float:center;margin:2px;padding:2px 0;display:blcok;height:22px;line-height:22px;}

#index_page{float:right;display:block;height:16px;padding:1px 0;margin-right:4px;}

#index_page *{float:left;display:inline;line-height:16px;border:1px solid #B6CFCD;text-align:center;padding:0;margin:0 2px;}

#index_page strong{background:#009A91;color:#fff;width:16px;}

#index_page span{color:#009a91;padding:3px 0 0 0;border:0;cursor:pointer;}

#index_page a{width:16px;color:#009A91;text-decoration:none;}

body,td,th {

font-size: 12px;

}

a {

font-size: 16px;

}

a:active {

text-decoration: none;

}

/style

link href="css/css.css" rel="stylesheet" type="text/css"

body

table width="200" border="0" align="center" cellpadding="0" cellspacing="0" class="jdt"

tr

tdscript language="javascript" type="text/javascript"

//![CDATA[

var _t1 = 0; //打開頁(yè)面時(shí)等待圖片載入的時(shí)間,單位為秒,可以設(shè)置為0

var _t2 = 5; //圖片輪轉(zhuǎn)的間隔時(shí)間

var _tnum = 4; //焦點(diǎn)圖個(gè)數(shù)

var _tn = 1;//當(dāng)前焦點(diǎn)

var _tl =null;

_tt1 = setTimeout('change_img()',_t1*1000);

function change_img(){

setFocus(_tn);

_tt1 = setTimeout('change_img()',_t2*1000);

}

function setFocus(i){

if(i_tnum){_tn=1;i=1;}

_tl?document.getElementById('focusPic'+_tl).style.display='none':'';

document.getElementById('focusPic'+i).style.display='block';

_tl=i;

_tn++;

}

//]]

/script

!--焦點(diǎn)圖1開始 標(biāo)題13字 說(shuō)明30個(gè)字--

div id="focusPic1"

a href="" class="i_photo_a" target="_blank"

img src="images/01.jpg" alt="這里是您的標(biāo)題一文字內(nèi)容" //a

h1a href="" target="_blank"這里是您的標(biāo)題一文字內(nèi)容/a/h1

div id="index_page"span onClick="javascript:setFocus(2);"點(diǎn)擊切換焦點(diǎn)圖→/span

strong1/strong

a href="javascript:setFocus(2);"2/a

a href="javascript:setFocus(3);"3/a

a href="javascript:setFocus(4);"4/a

/div/div

!--焦點(diǎn)圖1結(jié)束--

!--焦點(diǎn)圖2開始 標(biāo)題13字 說(shuō)明30個(gè)字--

div id="focusPic2" style="display:none;"

a href="" class="i_photo_a" target="_blank"

img src="images/02.jpg" alt="這里是您的標(biāo)題二文字內(nèi)容" //a

h1a href="" target="_blank"這里是您的標(biāo)題二文字內(nèi)容/a/h1

div id="index_page"span onClick="javascript:setFocus(3);"點(diǎn)擊切換焦點(diǎn)圖→/span

a href="javascript:setFocus(1);"1/a

strong2/strong

a href="javascript:setFocus(3);"3/a

a href="javascript:setFocus(4);"4/a

/div/div

!--焦點(diǎn)圖2結(jié)束--

!--焦點(diǎn)圖3開始 標(biāo)題13字 說(shuō)明30個(gè)字--

div id="focusPic3" style="display:none;"

a href="" class="i_photo_a" target="_blank"

img src="images/03.jpg" alt="這里是您的標(biāo)題三文字內(nèi)容" //a

h1a href="" target="_blank"這里是您的標(biāo)題三文字內(nèi)容/a/h1

div id="index_page"span onClick="javascript:setFocus(4);"點(diǎn)擊切換焦點(diǎn)圖→/span

a href="javascript:setFocus(1);"1/a

a href="javascript:setFocus(2);"2/a

strong3/strong

a href="javascript:setFocus(4);"4/a

/div/div

!--焦點(diǎn)圖3結(jié)束--

!--焦點(diǎn)圖4開始 標(biāo)題13字 說(shuō)明30個(gè)字--

div id="focusPic4" style="display:none;"

a href="" class="i_photo_a" target="_blank"

img src="images/04.jpg" alt="這里是您的標(biāo)題四文字內(nèi)容 " //a

h1a href="" target="_blank"這里是您的標(biāo)題四文字內(nèi)容/a/h1

div id="index_page"span onClick="javascript:setFocus(1);"點(diǎn)擊切換焦點(diǎn)圖→/span

a href="javascript:setFocus(1);"1/a

a href="javascript:setFocus(2);"2/a

a href="javascript:setFocus(3);"3/a

strong4/strong

/div/div

!--焦點(diǎn)圖4結(jié)束-- /td

/tr

/table

brbr

/body

/html

Jquery效果,多個(gè)DIV,點(diǎn)擊切換文字,變換背景顏色,再次點(diǎn)擊或者點(diǎn)擊其他div,文字和背景色變回來(lái)

css:

/*原來(lái)的背景色*/

.bg{background:'red'}

/*要切換的背景色*/

.bg_click{background:'green'}

js:

$('div').on('click',function(){

var $div = $(this);

var $others = $div.siblings();

if($div.hasClass('bg')){

$div.removeClass('bg').addClass('bg_click').html('你要變的文字');

}else{

$div.removeClass('bg_click').addClass('bg').html('原來(lái)的文字');

}

$others.addClass('bg').removeClass('bg_click').html('原來(lái)的文字');

});

jquery怎樣實(shí)現(xiàn)點(diǎn)擊按鈕切換div

div id="a1" class="someclass"1/div

div id="a2" class="someclass"2/div

script

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

$('.someclass').hide();

$(this).show();

});

/script

不知道你是不是要這樣

如何用jquery實(shí)現(xiàn)點(diǎn)擊div更換class?

jQuery中使用attr('屬性名')可以返回屬性的值。

語(yǔ)法:$(selector).attr([attribute]); // 返回attr中指定的當(dāng)前選擇器的屬性值;

例如:

$(selector).attr('id'); ?// 獲取選擇器的id

$(selector).attr('class'); // 獲取選擇器的class類名

實(shí)例:

1. 用jQuery獲取div的class類名:

1234div?class="mystyle"我是div/divscript????$('div').attr('class');?//?得到“mystyle”/script

2. 用jQuery獲取當(dāng)前點(diǎn)擊的button的id:

123456button?id="btn"?onclick="BtnClick(this)"按鈕/buttonscript????function?BtnClick(obj){????????$(obj).attr('id');?//?得到“btn”????}/script

可以采用如下思路:分別將兩種背景圖片設(shè)為兩個(gè)類,然后使用toggleClass()方法切換類:

$(selector).toggleClass('class_a').toggleClass('class_

創(chuàng)建Html代碼:一個(gè)簡(jiǎn)單的div用于顯示背景圖片

div?class="test"/div

設(shè)置css樣式:分別為兩個(gè)背景設(shè)計(jì)一個(gè)類

div.test{width:264px;height:152px;margin:50px;border:4px?dashed?#ccc;}

.bg1{background:url('bg1.png');}

.bg2{background:url('bg2.png');}

編寫jquery代碼:點(diǎn)擊切換類實(shí)現(xiàn)背景的變換

$(function(){

$("div.test").addClass('bg1');?//?初始化時(shí)添加背景1

$("div.test").click(function()?{

$(this).toggleClass('bg1').toggleClass('bg2')

網(wǎng)站欄目:jquery切換div,jquery切換圖片代碼
文章起源:http://chinadenli.net/article47/dsedphj.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司域名注冊(cè)品牌網(wǎng)站設(shè)計(jì)服務(wù)器托管標(biāo)簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

微信小程序開發(fā)