Share Bộ Code Trang Trí Noel Cho Blog Cực Đẹp Và Nhẹ !

1
Chào Các Bạn Đã Đến Blog Của Khánh Blog Nhá Sắp Đến Noel Rồi Hôm Nay Nay Mình Sẽ Share Cho Anh Em Bộ Code Trang Trí Noel  Cho Blog Cược Chất Kk :v
Trong Bộ Code Bao Gồm

  • Hiệu Ứng Tuyết Rơi.
  • Bộ Code Trang Trí Chuông Và Cây Thông 
Rồi Vào Làm Luôn Nhé !
Hình ảnh có liên quan
( Demo Như Hình Bên Dưới )

 

Đầu Tiên Là Trang Trí Hiệu Ứng Tuyết Rơi !

Bước 1 : Vào Phần Chỉnh Sửa HTML

Bước 2 : Dán Đoạn Mã Này Bên Trên Thẻ </body>



<!-- Snow -->
<style>
#snowflakeContainer{position:absolute;left:0px;top:0px;}
.snowflake{padding-left:15px;font-size:14px;line-height:24px;position:fixed;color: #FFFFFF;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;}
.snowflake:hover {cursor:default}
</style>
<div id='snowflakeContainer'>
<p class='snowflake'>&#8226;</p>
</div>
<script>
//<![CDATA[
// The star of every good animation
var requestAnimationFrame = window.requestAnimationFrame || 
window.mozRequestAnimationFrame || 
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame;

var transforms = ["transform", 
"msTransform", 
"webkitTransform", 
"mozTransform", 
"oTransform"];

var transformProperty = getSupportedPropertyName(transforms);

// Array to store our Snowflake objects
var snowflakes = [];

// Global variables to store our browser's window size
var browserWidth;
var browserHeight;

// Specify the number of snowflakes you want visible
var numberOfSnowflakes = 20;

// Flag to reset the position of the snowflakes
var resetPosition = false;

//
// It all starts here...
//
function setup() {
window.addEventListener("DOMContentLoaded", generateSnowflakes, false);
window.addEventListener("resize", setResetFlag, false);
}
setup();

//
// Vendor prefix management
//
function getSupportedPropertyName(properties) {
for (var i = 0; i < properties.length; i++) {
if (typeof document.body.style[properties[i]] != "undefined") {
return properties[i];
}
}
return null;
}

//
// Constructor for our Snowflake object
//
function Snowflake(element, radius, speed, xPos, yPos) {

// set initial snowflake properties
this.element = element;
this.radius = radius;
this.speed = speed;
this.xPos = xPos;
this.yPos = yPos;

// declare variables used for snowflake's motion
this.counter = 0;
this.sign = Math.random() < 0.5 ? 1 : -1;

// setting an initial opacity and size for our snowflake
this.element.style.opacity = .5 + Math.random();
this.element.style.fontSize = 6 + Math.random() * 20 + "px";
}

//
// The function responsible for actually moving our snowflake
//
Snowflake.prototype.update = function () {

// using some trigonometry to determine our x and y position
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;

// setting our snowflake's position
setTranslate3DTransform(this.element, Math.round(this.xPos), Math.round(this.yPos));

// if snowflake goes below the browser window, move it back to the top
if (this.yPos > browserHeight) {
this.yPos = -50;
}
}

//
// A performant way to set your snowflake's position
//
function setTranslate3DTransform(element, xPosition, yPosition) {
var val = "translate3d(" + xPosition + "px, " + yPosition + "px" + ", 0)";
element.style[transformProperty] = val;
}

//
// The function responsible for creating the snowflake
//
function generateSnowflakes() {

// get our snowflake element from the DOM and store it
var originalSnowflake = document.querySelector(".snowflake");

// access our snowflake element's parent container
var snowflakeContainer = originalSnowflake.parentNode;

// get our browser's size
browserWidth = document.documentElement.clientWidth;
browserHeight = document.documentElement.clientHeight;

// create each individual snowflake
for (var i = 0; i < numberOfSnowflakes; i++) {

// clone our original snowflake and add it to snowflakeContainer
var snowflakeCopy = originalSnowflake.cloneNode(true);
snowflakeContainer.appendChild(snowflakeCopy);

// set our snowflake's initial position and related properties
var initialXPos = getPosition(50, browserWidth);
var initialYPos = getPosition(50, browserHeight);
var speed = 5+Math.random()*40;
var radius = 4+Math.random()*10;

// create our Snowflake object
var snowflakeObject = new Snowflake(snowflakeCopy, 
radius, 
speed, 
initialXPos, 
initialYPos);
snowflakes.push(snowflakeObject);
}

// remove the original snowflake because we no longer need it visible
snowflakeContainer.removeChild(originalSnowflake);

// call the moveSnowflakes function every 30 milliseconds
moveSnowflakes();
}

//
// Responsible for moving each snowflake by calling its update function
//
function moveSnowflakes() {
for (var i = 0; i < snowflakes.length; i++) {
var snowflake = snowflakes[i];
snowflake.update();
}

// Reset the position of all the snowflakes to a new value
if (resetPosition) {
browserWidth = document.documentElement.clientWidth;
browserHeight = document.documentElement.clientHeight; 

for (var i = 0; i < snowflakes.length; i++) {
var snowflake = snowflakes[i];

snowflake.xPos = getPosition(50, browserWidth);
snowflake.yPos = getPosition(50, browserHeight);
}

resetPosition = false;
}

requestAnimationFrame(moveSnowflakes);
}

//
// This function returns a number between (maximum - offset) and (maximum + offset)
//
function getPosition(offset, size) {
return Math.round(-1*offset + Math.random() * (size+2*offset));
}

//
// Trigger a reset of all the snowflakes' positions
//
function setResetFlag(e) {
resetPosition = true;
}
//]]>
</script>


Rồi Đến Phần Trang Trí Chuông Và Cây Thông !

Bước 1 : Vào Phần Bố Cục 

Bước 2 : Chọn Thêm Tiện Ích 

Bước 3 : Kích Vào :  HTML/Javascript

Bước 4 : Dán Code Này Vào 


<script type="text/javascript">

document.write('<style type="text/css">body{padding-bottom:20px}</style><a href="#" target="_blank"><img style="position:fixed;z-index:9999;top:0;left:0" src="http://www.prthuonghieu.com/images/noel/top-left.png" _cke_saved_src="http://www.prthuonghieu.com/images/noel/top-right.png"/></a><a href="#" target="_blank"><img style="position:fixed;z-index:9999;top:0;right:0" src="http://www.prthuonghieu.com/images/noel/top-right.png"/></a><div style="position:fixed;z-index:9999;bottom:-50px;left:0;width:100%;height:104px;"></div><a href="#" target="_blank"><img style="position:fixed;z-index:9999;bottom:20px;left:20px" src="https://itexpress.vn/Cache/Uploads/ocuaso.combottomleft.png"/></a>');

var no=100;

var ie4up=(document.all)?1:0;
var ns6up=(document.getElementById&&!document.all)?1:0;
function iecompattest(){return(document.compatMode&&document.compatMode!='BackCompat')?document.documentElement:document.body}var dx,xp,yp;var am,stx,sty;var i,doc_width=800,doc_height=600;if(ns6up){doc_width=self.innerWidth;doc_height=self.innerHeight}else if(ie4up){doc_width=iecompattest().clientWidth;doc_height=iecompattest().clientHeight}dx=new Array();xp=new Array();yp=new Array();am=new Array();stx=new Array();sty=new Array();for(i=0;i<no;++i){dx[i]=0;xp[i]=Math.random()*(doc_width-50);yp[i]=Math.random()*doc_height;am[i]=Math.random()*20;stx[i]=0.02+Math.random()/10; sty[i]=0.7+Math.random();if(ie4up||ns6up){document.write('<div id="dot'+i+'" style="POSITION:absolute;Z-INDEX:'+i+';VISIBILITY:visible;TOP:15px;LEFT:15px;"><span style="font-size:18px;color:#fff">*</span><\/div>')}}
</script>

Bước 5 : Nhấn Lưu

Sau đó vào web cảm nhận :v

Đăng nhận xét

1 Nhận xét
  1. sửa lại domain liên kết giùm tui với ông: https://lopthuthuat.blogspot.com

    Trả lờiXóa
Đăng nhận xét
Trở Về Đầu Trang