![JS+CSS實(shí)現(xiàn)的美麗漸變背景特效代碼(6個(gè)漸變效果)__第1頁](http://file2.renrendoc.com/fileroot_temp3/2021-7/15/d28adfea-89b5-4401-a023-478e6562cba8/d28adfea-89b5-4401-a023-478e6562cba81.gif)
![JS+CSS實(shí)現(xiàn)的美麗漸變背景特效代碼(6個(gè)漸變效果)__第2頁](http://file2.renrendoc.com/fileroot_temp3/2021-7/15/d28adfea-89b5-4401-a023-478e6562cba8/d28adfea-89b5-4401-a023-478e6562cba82.gif)
![JS+CSS實(shí)現(xiàn)的美麗漸變背景特效代碼(6個(gè)漸變效果)__第3頁](http://file2.renrendoc.com/fileroot_temp3/2021-7/15/d28adfea-89b5-4401-a023-478e6562cba8/d28adfea-89b5-4401-a023-478e6562cba83.gif)
![JS+CSS實(shí)現(xiàn)的美麗漸變背景特效代碼(6個(gè)漸變效果)__第4頁](http://file2.renrendoc.com/fileroot_temp3/2021-7/15/d28adfea-89b5-4401-a023-478e6562cba8/d28adfea-89b5-4401-a023-478e6562cba84.gif)
![JS+CSS實(shí)現(xiàn)的美麗漸變背景特效代碼(6個(gè)漸變效果)__第5頁](http://file2.renrendoc.com/fileroot_temp3/2021-7/15/d28adfea-89b5-4401-a023-478e6562cba8/d28adfea-89b5-4401-a023-478e6562cba85.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、JS+CSS實(shí)現(xiàn)的美麗漸變背景特效代碼(6個(gè)漸變效果)_ 本文實(shí)例講解并描述了JS+CSS實(shí)現(xiàn)的美麗漸變背景特效代碼。分享給大家供大家參考,具體如下: 運(yùn)行效果截圖如下: 具體代碼如下: html head title JS配合CSS實(shí)現(xiàn)的美麗漸變背景特效6個(gè)實(shí)例 /title script var setGradient = (function() var p_dCanvas = document.createElement(canvas); var p_useCanvas = !(typeof(p_dCanvas.getContext) = function); var p_dCtx =
2、p_useCanvas ? p_dCanvas.getContext(2d) : null; var p_isIE = /*cc_on!*/ false; try p_dCtx.canvas.toDataURL() catch(err) p_useCanvas = false; ; if (p_useCanvas) return function(dEl, sColor1, sColor2, bRepeatY) if (typeof(dEl) = string) dEl = document.getElementById(dEl); if (!dEl) return false; var nW
3、 = dEl.offsetWidth; var nH = dEl.offsetHeight; p_dCanvas.width = nW; p_dCanvas.height = nH; var dGradient; var sRepeat; if (bRepeatY) dGradient = p_dCtx.createLinearGradient(0, 0, nW, 0); sRepeat = repeat-y; else dGradient = p_dCtx.createLinearGradient(0, 0, 0, nH); sRepeat = repeat-x; dGradient.add
4、ColorStop(0, sColor1); dGradient.addColorStop(1, sColor2); p_dCtx.fillStyle = dGradient; p_dCtx.fillRect(0, 0, nW, nH); var sDataUrl = p_dCtx.canvas.toDataURL(image/png); with(dEl.style) backgroundRepeat = sRepeat; backgroundImage = url( + sDataUrl + ); backgroundColor = sColor2; ; else if (p_isIE)
5、p_dCanvas = p_useCanvas = p_dCtx = null; return function(dEl, sColor1, sColor2, bRepeatY) if (typeof(dEl) = string) dEl = document.getElementById(dEl); if (!dEl) return false; dEl.style.zoom = 1; var sF = dEl.currentStyle.filter; dEl.style.filter += + progid:DXImageTransform.Microsoft.gradient( Grad
6、ientType=, +( ! bRepeatY), ,enabled=true,startColorstr=, sColor1, , endColorstr=, sColor2, ).join(); ; else p_dCanvas = p_useCanvas = p_dCtx = null; return function(dEl, sColor1, sColor2) if (typeof(dEl) = string) dEl = document.getElementById(dEl); if (!dEl) return false; with(dEl.style) background
7、Color = sColor2; ; )(); /script style bodyfont:0.75em/1.4 Arial;text-align:left;margin:20px; hrclear:both;visibility:hidden; xmpfont:12px/12px Courier New;background:#fff;color:#666; border:solid 1px #ccc; div.example border:solid 1px #555;margin:0 20px 20px 0;float:left; display:inline;margin:1em;b
8、ackground:#fff;width:300px;padding:40px;color:#222;font:xx-small/1.2 Tahoma;text-align:justify; /style body div id=example1 class=example CSS特效代碼。 /div div id=example2 class=example 各類編程源碼、 /div div id=example3 class=example 精品軟件 /div div id=example4 class=example 上海世博園 /div div id=example5 class=example 我家北京天安門 /div div id=example6 class=example 北京歡迎您! /div script setGradient(example1, #4ddbbe, #d449cc, 1); setGradient(example2, #46ddbd, #d8b617, 0); setGradient(example3, #c81fc1, #bf445f, 1); setGradient(example4, #2285e5, #d769eb, 0
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 未來十年移動(dòng)支付的科技發(fā)展趨勢(shì)預(yù)測(cè)
- 標(biāo)準(zhǔn)化管理在生產(chǎn)現(xiàn)場(chǎng)的挑戰(zhàn)與對(duì)策
- 現(xiàn)代音樂文化的全球化傳播路徑
- 13人物描寫一組(說課稿)2023-2024學(xué)年統(tǒng)編版語文五年級(jí)下冊(cè)
- Unit 1 Playtime Lesson 3(說課稿)-2023-2024學(xué)年人教新起點(diǎn)版英語二年級(jí)下冊(cè)001
- 25 少年閏土 第二課時(shí) 說課稿-2024-2025學(xué)年語文六年級(jí)上冊(cè) 統(tǒng)編版
- Unit1 London is a big city(說課稿)2023-2024學(xué)年外研版(三起)四年級(jí)下冊(cè)
- 2024-2025學(xué)年高中生物 第七章 現(xiàn)代生物進(jìn)化理論 第1節(jié) 現(xiàn)代生物進(jìn)化理論的由來說課稿3 新人教版必修2
- Unit 2 Being a good language learner Exploring and Using 說課稿-2024-2025學(xué)年高中英語重大版(2019)必修第一冊(cè)
- 2025挖掘機(jī)勞動(dòng)合同范文
- 北師大版五年級(jí)上冊(cè)四則混合運(yùn)算100道及答案
- 專項(xiàng)債券在燃?xì)饣A(chǔ)設(shè)施建設(shè)中的融資作用
- 人教部編版道德與法治八年級(jí)下冊(cè):6.3 《國(guó)家行政機(jī)關(guān)》說課稿1
- GE-LM2500+G4航改燃?xì)廨啓C(jī)在艦船和工業(yè)上的應(yīng)用
- 2024山東能源集團(tuán)中級(jí)人才庫(kù)選拔(高頻重點(diǎn)提升專題訓(xùn)練)共500題附帶答案詳解
- 鋼鐵是怎樣煉成的讀后感作文700字
- 武漢市江夏區(qū)2022-2023學(xué)年七年級(jí)上學(xué)期期末數(shù)學(xué)試卷【帶答案】-109
- 學(xué)校物業(yè)服務(wù)合同范本專業(yè)版
- SL 288-2014 水利工程施工監(jiān)理規(guī)范
- 部編版八年級(jí)語文上冊(cè)期末考試卷
- 2024年02月中央軍委后勤保障部2024年公開招考專業(yè)技能崗位文職人員筆試參考題庫(kù)附帶答案詳解
評(píng)論
0/150
提交評(píng)論