時(shí)間:2023-09-02 03:12:02 | 來源:網(wǎng)站運(yùn)營
時(shí)間:2023-09-02 03:12:02 來源:網(wǎng)站運(yùn)營
如何用代碼快速制作營銷網(wǎng)站底部廣告?:當(dāng)前在很多的旅游網(wǎng)站,底部固定廣告已經(jīng)成為一種常見的形式,可以參看下圖。<style type="text/css">*{margin:0;padding:0;}body{background: url('images/body-bg.png') no-repeat center top;}.box{width: 100%;height: 147px;position: fixed;bottom: 0;left: 0;background: rgba(0, 5, 25,.8);}.box-inner{width:1000px;height:147px;margin:0 auto;position:relative;}.box-inner .person{position: absolute;left:0;bottom:0;}.box-inner .btn{position: absolute;left:0;top: 5px;cursor: pointer;}.people{position: fixed;left:-130px;bottom: 0;cursor: pointer;}</style>
Html部分代碼如下:<div class="box"> <div class="box-inner"> <img class="person" src="images/adv.png" height="195" width="1000" alt="" /> <img src="images/btn_close.png" height="39" width="39" alt="" class="btn" /> </div> </div><div class="people"> <img src="images/people.png" height="154" width="130" alt="" /></div>
2. 通過jquery代碼來實(shí)現(xiàn)兩者之間的切換var winWidth = $(window).width();$('.btn').click(function(event) { $('.box').animate({left:-winWidth}, 500,function(){ $('.people').animate({left:0}, 500); });});
在第二組盒子中,給整個(gè)盒子添加點(diǎn)擊事件,動(dòng)畫方式和第一次點(diǎn)擊相反;第二組盒子往左側(cè)移出窗口以外;第一組盒子從窗口以外重新進(jìn)入到窗口中,同樣在此處也用到了ainimate中的回調(diào)函數(shù),為了讓兩組動(dòng)畫之間時(shí)間上產(chǎn)生間距,通過delay方法做了延遲執(zhí)行。$('.people').click(function(event) { $(this).animate({left:-130}, 0,function(){ $('.box').delay(300).animate({left:0}, 500); }); });
關(guān)鍵詞:廣告
客戶&案例
營銷資訊
關(guān)于我們
微信公眾號(hào)
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。