តើអ្នកចង់លម្អរប្លក់របស់អ្នកឲមានភាពស្រស់ស្អាតដែរឬទេ? ក្នុងគន្លឹះថ្ងៃនេះខ្ញុំនឹងបង្ហាញអំពី របៀបក្នុងការ ដាក់ព្រិលធ្លាក់នៅលើប្លក់ ប្រសិនបើអ្នកចូលចិត្តនូវគន្លឹះមួយនេះ តោះ! ទៅរៀនដាក់ ជាមួយខ្ញុំនៅខាងក្រោម ទាំងអស់គ្នា។
១-សូមចូលទៅកាន់គណនីប្លក់របស់អ្នក
២-ចូលទៅកាន់ Theme បន្ទាប់មក Edit HTML
៣-ចម្លងកូដខាងក្រោមដាក់ពីខាងលើ </head>
១-សូមចូលទៅកាន់គណនីប្លក់របស់អ្នក
២-ចូលទៅកាន់ Theme បន្ទាប់មក Edit HTML
៣-ចម្លងកូដខាងក្រោមដាក់ពីខាងលើ </head>
<style type='text/css'>
#snowflakeContainer{position:absolute;left:0;top:0}
.snowflake{padding-left:15px;font-family:Cambria,Georgia,serif;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>
៤-ចម្លងកូដខាងក្រោមដាក់ពីខាងលើ </body> <div id='snowflakeContainer'>
<p class='snowflake'>*</p>
</div>
៥-ចម្លងកូដខាងក្រោមដាក់ពីខាងលើ </body> <script>
var requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;var transforms=["transform","msTransform","webkitTransform","mozTransform","oTransform"];var transformProperty=getSupportedPropertyName(transforms);var snowflakes=[];var browserWidth;var browserHeight;var numberOfSnowflakes=50;var resetPosition=false;function setup(){window.addEventListener("DOMContentLoaded",generateSnowflakes,false);window.addEventListener("resize",setResetFlag,false);}
setup();function getSupportedPropertyName(properties){for(var i=0;i<properties.length;i++){if(typeof document.body.style[properties[i]]!="undefined"){return properties[i];}}
return null;}
function Snowflake(element,radius,speed,xPos,yPos){this.element=element;this.radius=radius;this.speed=speed;this.xPos=xPos;this.yPos=yPos;this.counter=0;this.sign=Math.random()<0.5?1:-1;this.element.style.opacity=.1+Math.random();this.element.style.fontSize=12+Math.random()*50+"px";}
Snowflake.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(element,xPosition,yPosition){var val="translate3d("+xPosition+"px,"+yPosition+"px"+",0)";element.style[transformProperty]=val;}
function generateSnowflakes(){var originalSnowflake=document.querySelector(".snowflake");var snowflakeContainer=originalSnowflake.parentNode;browserWidth=document.documentElement.clientWidth;browserHeight=document.documentElement.clientHeight;for(var i=0;i<numberOfSnowflakes;i++){var snowflakeCopy=originalSnowflake.cloneNode(true);snowflakeContainer.appendChild(snowflakeCopy);var initialXPos=getPosition(50,browserWidth);var initialYPos=getPosition(50,browserHeight);var speed=5+Math.random()*40;var radius=4+Math.random()*10;var snowflakeObject=new Snowflake(snowflakeCopy,radius,speed,initialXPos,initialYPos);snowflakes.push(snowflakeObject);}
snowflakeContainer.removeChild(originalSnowflake);moveSnowflakes();}
function moveSnowflakes(){for(var i=0;i<snowflakes.length;i++){var snowflake=snowflakes[i];snowflake.update();}
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);}
function getPosition(offset,size){return Math.round(-1*offset+Math.random()*(size+2*offset));}
function setResetFlag(e){resetPosition=true;}
</script>
៦-ចុចពាក្យ Save Theme។
Comments
Post a Comment