Yuav Ua Cas Thiaj Xaiv Divas

Cov txheej txheem:

Yuav Ua Cas Thiaj Xaiv Divas
Yuav Ua Cas Thiaj Xaiv Divas

Video: Yuav Ua Cas Thiaj Xaiv Divas

Video: Yuav Ua Cas Thiaj Xaiv Divas
Video: Yuav Ua Ca Thiaj Yuag 5/30/21 2024, Hlis ntuj nqeg
Anonim

Cov tag yog nquag siv hauv kev tsim web los tsim cov blocks ntawm html nplooj ntawv, sab hauv uas koj tuaj yeem tso cov ntsiab lus ntawm txhua qhov - cov ntawv nyeem, duab, rooj thiab lwm yam.

Yuav ua cas thiaj xaiv divas
Yuav ua cas thiaj xaiv divas

Cov Lus Qhia

Kauj ruam 1

Thaum siv, yuav tsum muaj tus cim xaus kawg. Nws tuaj yeem siv nrog cov cwj pwm hauv qab no:

- dlhos - teeb mus ua ke (sab laug, nruab nrab, sab xis, xis yam), piv txwv li, Ntawv;

- chav kawm - chav kawm lub npe (Ntawv nyeem);

- id - lub npe ntawm html tag cim kom raug;

- qauv - hom kev coj;

- npe - tooltip.

Kauj ruam 2

Thaum siv cov blocks, nws raug nquahu kom siv cov ntawv style. Piv txwv li, yog tias koj xav tsim ob qho sib txawv nrog cov ntsiab lus ntawm nplooj ntawv, tom qab ntawd cov cai yuav saib zoo li no:

.block1 {

dav: 500px;

qhov siab: 200px;

tom qab: Daj;

padding: 0px;

padding-txoj cai: 0px;

ciam teb: khoom 0px dub;

ntab: laug;

}

.block2 {

dav: 200px;

qhov siab: 500;

tom qab: Ntsuab;

padding: 0px;

padding-txoj cai: 0px;

ciam teb: khoom 0px dub;

ntab: txoj cai;

}

Lub daj daj yog thawj tus nrog qhov dav 500px thiab qhov ntev ntawm 200px.

Lub tsev ntsuab yog thawj zaug uas muaj qhov dav 200px thiab qhov ntev ntawm 500px.

Kauj ruam 3

Txoj cai-sab / sab laug-sib ncaug ntawm cov blocks tuaj yeem tsim tau siv cov qauv:

.leftimg {

ntab: laug;

cov npoo: 5px 15px 7px 0;

}

.rightimg {

ntab: txoj cai;

npoo: 7px 0 7px 7px;

}

Kauj ruam 4

Nrog kev pab ntawm cov kab, koj tuaj yeem npaj cov kev hloov pauv ntawm cov duab.

div # rotator {txoj hauj lwm: txheeb ze; qhov siab: 150px; npoo-lauj: 15px;}

div # rotator ul li {ntab: sab laug; txoj hauj lwm: txog; sau-style: tsis muaj;}

div # rotator ul li.show {z-index: 500;}

ua haujlwm theRotator () {

$ ('div # rotator ul li'). css ({opacity: 0.0});

$ ('div # rotator ul li: thawj'). css ({opacity: 1.0});

setInterval ('tig ()', 5000);

}

muaj nuj nqi tig () {

var current = ($ ('div # rotator ul li.show')? $ ('div # rotator ul li.show'): $ ('div # rotator ul li: thawj'));

var next = ((current.next (). ntev)) ((current.next (). hasClass ('qhia'))? $ ('div # rotator ul li: thawj'): current.next ()): $ ('div # rotator ul li: thawj'));

// var sibs = current.siblings ();

// var rndNum = Math.floor (Math.random () * sibs.length);

// var next = $ (kwv tij [rndNum]);

next.css ({opacity: 0.0})

.addClass ('qhia tau tias')

.animate ({opacity: 1.0}, 1000);

current.animate ({opacity: 0.0}, 1000)

.removeClass ('qhia tau');

};

$ (daim ntawv).ready (muaj nuj nqi () {

theRotator ();

});

Pom zoo: