日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
基于mootools1.3框架下的圖片滑動(dòng)

MooTools是一個(gè)簡(jiǎn)潔,模塊化,面向?qū)ο蟮拈_源JavaScript web應(yīng)用框架。它為web開發(fā)者提供了一個(gè)跨瀏覽器js解決方案。在處理js css html時(shí)候。它提供了一個(gè)比普通js更面向?qū)ο蟮膁ocument API。

成都創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:做網(wǎng)站、網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的陸良網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

效果預(yù)覽如下:

實(shí)現(xiàn)原理:

容器采用相對(duì)定位,圖片采用絕對(duì)定位,當(dāng)鼠標(biāo)移動(dòng)到相應(yīng)的圖片上,改變?nèi)eft屬性,用tween實(shí)現(xiàn)動(dòng)畫效果.

代碼分析:寫一個(gè)picSlider類實(shí)現(xiàn)代碼封裝

 
 
 
  1.         
  2.         
  3.         
  4.         
  5.         
  6.     

CSS樣式

 
 
 
  1. #container{width:459px; height:200px; backgroundcolor:Black;position:relative;overflow:hidden;
  2. #container img{position:absolute;width:360px;height:300px;display:block;top:0;width:280px;height:200px;}

JS:picSlider類

 
 
 
  1. var picSlider = new Class(
  2. Implements: Options, options: 
  3. container: "container", imgsWidth: 0.6, 
  4. }, 
  5. initialize: function (options) 
  6. this.setOptions(options); 
  7. this.container = $(this.options.container); this.triggers = this.container.getElementsByTagName
  8. ("img"); 
  9. this.containerWidth = this.container.getSize().x; 
  10. //get container's width this.imgWidth = this.containerWidth * this.options.imgsWidth; this.aveWidth = this.containerWidth 
  11. / this.triggers.length; this.newAveWidth = (this.containerWidth - this.imgWidth) 
  12. / (this.triggers.length - 1); this.setImgsInit(); 
  13. //初始化圖片展示 this.start(); }, 
  14. setImgsInit:function(){ 
  15. for(var i=0;i
  16. this.triggers[i].setStyle("left",i*this.aveWidth); 
  17. } }, 
  18. start:function(){ 
  19. for(var i=0;i
  20. this.triggers[i].set("tween",{property:"left",duration:300, fps:80}); 
  21. //為每個(gè)元素設(shè)置動(dòng)畫參數(shù) 
  22. this.triggers[i].addEvent("mouseover",this.slider.bindWithEvent(this,[i]));
  23. //綁定slider函數(shù) } 
  24. }, 
  25. slider:function(e,at){ 
  26. e.stop(); 
  27. for(var i=1;i
  28. if(i<=at){ 
  29. this.triggers[i].get("tween").start(i*this.newAveWidth); 
  30. }else{ 
  31. this.triggers[i].get("tween").start(this.imgWidth+(i-1)*this.newAveWidth); 
  32. } } }});
  33. new picSlider();

如果想直接在本地運(yùn)行,請(qǐng)引入

 
 
 

這個(gè)腳本必須在

后面,原因不解釋!

請(qǐng)問哪位朋友知道怎么在效果預(yù)覽里面引入JS框架,好像不支持!有知道的嗎?


新聞名稱:基于mootools1.3框架下的圖片滑動(dòng)
轉(zhuǎn)載來于:http://www.dlmjj.cn/article/djsjjce.html