An Trần Digital
No Result
View All Result
Thứ Sáu, Tháng Sáu 6, 2025
  • Thủ thuật
    • Blogspot/Blogger
    • Phần Mềm
    • WordPress
    • Plugin WordPress
  • Đồ hoạ
    • Action Photoshop
    • Preset Camera Raw
    • Preset Lightroom Mobile
    • Preset Lightroom PC
  • Themes
    • Blogger/Blogspot
    • WordPress
  • Khoá học miễn phí
    • Adobe
    • Kỹ Năng Đời Sống
    • Lập Trình – Web
    • Marketing – SEO
  • Source Code
  • Mã giảm giá Shopee, Tiki
Ủng hộ tôi
An Trần Digital
  • Thủ thuật
    • Blogspot/Blogger
    • Phần Mềm
    • WordPress
    • Plugin WordPress
  • Đồ hoạ
    • Action Photoshop
    • Preset Camera Raw
    • Preset Lightroom Mobile
    • Preset Lightroom PC
  • Themes
    • Blogger/Blogspot
    • WordPress
  • Khoá học miễn phí
    • Adobe
    • Kỹ Năng Đời Sống
    • Lập Trình – Web
    • Marketing – SEO
  • Source Code
  • Mã giảm giá Shopee, Tiki
No Result
View All Result
An Trần Digital
No Result
View All Result

Home - Source Code - Code hiệu ứng hoa mai rơi cho blog/website

Code hiệu ứng hoa mai rơi cho blog/website

by An Tran
02/01/2023
in Source Code
Reading Time: 5 mins read
A A
1
Code hiệu ứng hoa mai rơi cho blog/website
116
SHARES
1.4k
VIEWS

Nội dung bài viết

  1. Code hoa mai rơi dành cho website
  2. Code hoa mai rơi dành cho blogspot/blogger

Nhân dịp năm mới đã tới và Tết Nguyên Đán chỉ còn chưa tới 30 ngày nữa là sẽ đến. Nên nay mình chia sẻ cách tạo hiệu ứng hoa mai rơi cho website để cùng nhau cho có không khí tết năm mới đầy may mắn.

Dưới đây là code hiệu ứng hoa mai rơi cho blog/website 

Code hoa mai rơi dành cho website

Copy đoạn code bên dưới và sau đó dán trên thẻ </body>

Để duy trì blog ngoài link rút gọn & mình có làm aff cho 1 số bên hosting.

Các nhà cung cấp uy tín về mặt chất lượng & đội ngũ support nên mọi người cứ yên tâm.

Nếu bạn đang có ý định mua Hosting, VPS mình có list dưới đây các bạn click vào link trước khi mua để ủng hộ mình nhé. Mình cảm ơn nhiều

  • Azdigi: Giá rẻ thì dùng gói Pro Gold Hosting còn chất lượng hơn thì em khuyên dùng Business Hosting. Có điều kiện thì lên VPS nhé
  • Tino: Business Hosting, NVMe Hosting và NVMe VPS
  • iNet: Cloud VPS và Web Hosting
<style>
    #hoamaitet{position:absolute;left:0px;top:0px;}
    .hoamai{padding-left:15px;font-size:14px;line-height:24px;position:fixed;color:#ebebeb;user-select:none;z-index:1000;-moz-user-select:none;-ms-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;}
    .hoamai:hover {cursor:default}
</style>
<div id='hoamaitet'>
<p class='hoamai'><img style="width:20px" src="https://1.bp.blogspot.com/-CXx9jt2JMRk/Vq-Lh5fm88I/AAAAAAAASwo/XivooDn_oSY/s1600/hoamai.png" /></p>
</div>
<script style='text/javascript'>
    //<![CDATA[
    var requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;var transforms=["transform","msTransform","webkitTransform","mozTransform","oTransform"];var transformProperty=getSupportedPropertyName(transforms);var hoamais=[];var browserWidth;var browserHeight;var numberOfhoamais=50;var resetPosition=false;function setup(){window.addEventListener("DOMContentLoaded",generatehoamais,false);window.addEventListener("resize",setResetFlag,false)}setup();function getSupportedPropertyName(b){for(var a=0;a<b.length;a++){if(typeof document.body.style[b[a]]!="undefined"){return b[a]}}return null}function hoamai(b,a,d,e,c){this.element=b;this.radius=a;this.speed=d;this.xPos=e;this.yPos=c;this.counter=0;this.sign=Math.random()<0.5?1:-1;this.element.style.opacity=0.5+Math.random();this.element.style.fontSize=4+Math.random()*30+"px"}hoamai.prototype.update=function(){this.counter+=this.speed/5000;this.xPos+=this.sign*this.speed*Math.cos(this.counter)/40;this.yPos+=Math.sin(this.counter)/40+this.speed/30;setTranslate3DTransform(this.element,Math.round(this.xPos),Math.round(this.yPos));if(this.yPos>browserHeight){this.yPos=-50}};function setTranslate3DTransform(a,c,b){var d="translate3d("+c+"px, "+b+"px, 0)";a.style[transformProperty]=d}function generatehoamais(){var b=document.querySelector(".hoamai");var h=b.parentNode;browserWidth=document.documentElement.clientWidth;browserHeight=document.documentElement.clientHeight;for(var d=0;d<numberOfhoamais;d++){var j=b.cloneNode(true);h.appendChild(j);var e=getPosition(50,browserWidth);var a=getPosition(50,browserHeight);var c=5+Math.random()*40;var g=4+Math.random()*10;var f=new hoamai(j,g,c,e,a);hoamais.push(f)}h.removeChild(b);movehoamais()}function movehoamais(){for(var b=0;b<hoamais.length;b++){var a=hoamais[b];a.update()}if(resetPosition){browserWidth=document.documentElement.clientWidth;browserHeight=document.documentElement.clientHeight;for(var b=0;b<hoamais.length;b++){var a=hoamais[b];a.xPos=getPosition(50,browserWidth);a.yPos=getPosition(50,browserHeight)}resetPosition=false}requestAnimationFrame(movehoamais)}function getPosition(b,a){return Math.round(-1*b+Math.random()*(a+2*b))}function setResetFlag(a){resetPosition=true};
    //]]>
</script>

Demo

Xem thêm: Code web đếm ngày yêu

Code hoa mai rơi dành cho blogspot/blogger

Vào Blog của bạn, sau đó vào Chủ đề => Chỉnh sửa HTML. Tiếp theo dán đoạn code bên dưới trên thẻ </head>

<script type='text/javascript'>
//<![CDATA[
var pictureSrc ="https://1.bp.blogspot.com/-CXx9jt2JMRk/Vq-Lh5fm88I/AAAAAAAASwo/XivooDn_oSY/s1600/hoamai.png"; //the location of the snowflakes
var pictureWidth = 15; //the width of the snowflakes
var pictureHeight = 15; //the height of the snowflakes
var numFlakes = 10; //the number of snowflakes
var downSpeed = 0.01; //the falling speed of snowflakes (portion of screen per 100 ms)
var lrFlakes = 10; //the speed that the snowflakes should swing from side to side
if( typeof( numFlakes ) != 'number' || Math.round( numFlakes ) != numFlakes || numFlakes < 1 ) { numFlakes = 10; }
//draw the snowflakes
for( var x = 0; x < numFlakes; x++ ) {
if( document.layers ) { //releave NS4 bug
document.write('<layer id="snFlkDiv'+x+'"><imgsrc="'+pictureSrc+'" height="'+pictureHeight+'"width="'+pictureWidth+'" alt="*" border="0"></layer>');
} else {
document.write('<div style="position:absolute; z-index:9999;"id="snFlkDiv'+x+'"><img src="'+pictureSrc+'"height="'+pictureHeight+'" width="'+pictureWidth+'" alt="*"border="0"></div>');
}
}
//calculate initial positions (in portions of browser window size)
var xcoords = new Array(), ycoords = new Array(), snFlkTemp;
for( var x = 0; x < numFlakes; x++ ) {
xcoords[x] = ( x + 1 ) / ( numFlakes + 1 );
do { snFlkTemp = Math.round( ( numFlakes - 1 ) * Math.random() );
} while( typeof( ycoords[snFlkTemp] ) == 'number' );
ycoords[snFlkTemp] = x / numFlakes;
}
//now animate
function flakeFall() {
if( !getRefToDivNest('snFlkDiv0') ) { return; }
var scrWidth = 0, scrHeight = 0, scrollHeight = 0, scrollWidth = 0;
//find screen settings for all variations. doing this every time allows for resizing and scrolling
if( typeof( window.innerWidth ) == 'number' ) { scrWidth = window.innerWidth; scrHeight = window.innerHeight; } else {
if( document.documentElement && (document.documentElement.clientWidth ||document.documentElement.clientHeight ) ) {
scrWidth = document.documentElement.clientWidth; scrHeight = document.documentElement.clientHeight; } else {
if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
scrWidth = document.body.clientWidth; scrHeight = document.body.clientHeight; } } }
if( typeof( window.pageYOffset ) == 'number' ) { scrollHeight = pageYOffset; scrollWidth = pageXOffset; } else {
if( document.body && ( document.body.scrollLeft ||document.body.scrollTop ) ) { scrollHeight = document.body.scrollTop;scrollWidth = document.body.scrollLeft; } else {
if(document.documentElement && (document.documentElement.scrollLeft ||document.documentElement.scrollTop ) ) { scrollHeight =document.documentElement.scrollTop; scrollWidth =document.documentElement.scrollLeft; } }
}
//move the snowflakes to their new position
for( var x = 0; x < numFlakes; x++ ) {
if( ycoords[x] * scrHeight > scrHeight - pictureHeight ) { ycoords[x] = 0; }
var divRef = getRefToDivNest('snFlkDiv'+x); if( !divRef ) { return; }
if( divRef.style ) { divRef = divRef.style; } var oPix = document.childNodes ? 'px' : 0;
divRef.top = ( Math.round( ycoords[x] * scrHeight ) + scrollHeight ) + oPix;
divRef.left = ( Math.round( ( ( xcoords[x] * scrWidth ) - (pictureWidth / 2 ) ) + ( ( scrWidth / ( ( numFlakes + 1 ) * 4 ) ) * (Math.sin( lrFlakes * ycoords[x] ) - Math.sin( 3 * lrFlakes * ycoords[x]) ) ) ) + scrollWidth ) + oPix;
ycoords[x] += downSpeed;
}
}
//DHTML handlers
function getRefToDivNest(divName) {
if( document.layers ) { return document.layers[divName]; } //NS4
if( document[divName] ) { return document[divName]; } //NS4 also
if( document.getElementById ) { return document.getElementById(divName); } //DOM (IE5+, NS6+, Mozilla0.9+, Opera)
if( document.all ) { return document.all[divName]; } //Proprietary DOM - IE4
return false;
}
window.setInterval('flakeFall();',100);
//]]>
</script>

Bạn có thể tuỳ chỉnh

  • Muốn thay đổi hình hoa mai thành hoa đào hay tuyết rơi,…thì chỉ cần đổi link hình ảnh này https://1.bp.blogspot.com/-CXx9jt2JMRk/Vq-Lh5fm88I/AAAAAAAASwo/XivooDn_oSY/s1600/hoamai.png
  • 15 là chiều rộng của bông
  • 15 Chiều rộng của bông.
  • 15 Chiều cao của bông.
  • 10 Số bông hoa xuất hiện cùng một lúc.
  • 0,01 Tốc độ rơi của các bông hoa.
  • 10 Tốc độ các bông hoa giao động từ bên trái sang bên phải và ngược lại.

CHÚC CÁC BẠN THÀNH CÔNG !!!

Tags: code hoa mai rơicode trang trí tết cho website cho website wordpresscode web
Previous Post

Code tuyết rơi trang trí noel cho website/blog

Next Post

Chia sẻ bộ Preset Lightroom màu kỷ yếu đẹp cho học sinh

An Tran

An Tran

Tôi là An Trần, thuộc thế hệ 9X. Hiện tại đang làm nhân viên cắt cỏ tại sân Old Trafford.

Related Posts

Prompt AI là gì

Prompt AI là gì? Các loại và cách viết Prompt hiệu quả nhất

19/02/2025
Source Code Web Bán Hàng Thời Trang ASP.NET MVC giá rẻ

Source Code Web Bán Hàng Thời Trang ASP.NET MVC

27/04/2024
Code pháo hoa chơ website

Tổng hợp code pháo hoa cho website HTML đẹp

13/12/2023
Code tạo hiệu ứng tuyết rơi

Code tạo hiệu ứng tuyết rơi V2 trang trí noel

12/12/2023
Next Post
Chia sẻ bộ Preset Lightroom màu kỷ yếu đẹp cho học sinh

Chia sẻ bộ Preset Lightroom màu kỷ yếu đẹp cho học sinh

Subscribe
Notify of
guest

Hãy dùng tên của bạn khi comment, không sử dụng keyword trong ô Tên. Xin cảm ơn!

guest

Hãy dùng tên của bạn khi comment, không sử dụng keyword trong ô Tên. Xin cảm ơn!

1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
wpdiscuz   wpDiscuz

BÀI VIẾT NGẪU NHIÊN

chia-se-powerpoint-template-sieu-sin-antrandigital

Chia sẻ PowerPoint Templates Siêu Xịn Giá Vài Trăm Đô

04/07/2020
Hướng dẫn xoá category trong url wordpress

Hướng dẫn cách xoá Category trong Url wordpress

28/04/2022
chia-se-preset-camera-raw-han-quoc-antrandigital

Chia sẻ preset camera raw hàn quốc xẻng blend ảnh đẹp

30/12/2020
Cách ẩn widget trên giao diện điện thoại cho website wordpress an trần digital

[WordPress] Cách ẩn Widget trên giao diện mobile cho website

05/01/2022

HOSTING / VPS KHUYÊN DÙNG

logo azdigi

Hosting WordPress chất lượng cao. Support tốt 24/7. Xem ngay

logo inet

Nhà cung cấp hosting, tên miền có lâu đời ở Việt Nam. Xem ngay

logo tinohost

Hosting WordPress chất lượng cao. Support tốt. Dùng thử 7 ngày. Click để nhận mã giảm 10% ngay. Xem ngay


An Trần Digital là blog cá nhân chia sẻ preset lightroom, camera raw từ máy tính đến mobile, template blogspot, theme wordpress và các khoá học khác hoàn toàn miễn phí.

DMCA.com Protection Status

Comments gần đây

  • An Tran
    Quản lý
    trong Share Key Screaming Frog SEO Spider
  • gia cat luoing trong Share Key Screaming Frog SEO Spider
  • An Tran
    Quản lý
    trong Share Key Screaming Frog SEO Spider

Xem nhiều nhất ngày

Share Key Screaming Frog SEO Spider

2000+ Preset Camera Raw chỉnh màu ảnh đẹp nhất

Về An Trần Digital

Giới thiệu về tôi

Bảo mật

Hợp tác

Bản quyền

Liên hệ

Donate

© 2020 An Trần Digital - All Rights Reserved

No Result
View All Result
  • Thủ thuật
    • Blogspot/Blogger
    • Phần Mềm
    • WordPress
    • Plugin WordPress
  • Đồ hoạ
    • Action Photoshop
    • Preset Camera Raw
    • Preset Lightroom Mobile
    • Preset Lightroom PC
  • Themes
    • Blogger/Blogspot
    • WordPress
  • Khoá học miễn phí
    • Adobe
    • Kỹ Năng Đời Sống
    • Lập Trình – Web
    • Marketing – SEO
  • Source Code
  • Mã giảm giá Shopee, Tiki

© 2020 An Trần Digital - All Rights Reserved

wpDiscuz

Đồng ý sử dụng cookie

Những cookie này giúp trang web ghi nhớ thông tin về lần truy cập của bạn. Nhờ đó, bạn có thể truy cập trang web này dễ dàng hơn vào lần tới và trang web cũng trở nên hữu ích hơn cho bạn. Tìm hiểu thêm