jQuery Plugin For Animated Hexagon Background - Hex

jQuery Plugin For Animated Hexagon Background - Hex
File Size: 220 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Hex is a JQuery plugin that enables you apply a fancy Hexagon Animation effect on an DOM element's background.

How to use it:

1. Include jQuery javascript library and jQuery Hex plugin in the web page.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="hexmin.js"></script>

2. Create an DOM element where you want to apply on an animated hexagon background.

<div class="demo"> </div>

3. The DOM element you just created needs to have the position: relative or position: absolute set in the css.

div.demo {
position: absolute;
...
}

4. Enable the effect on the DOM element.

<script type="text/javascript">
$(document).ready(function(){
show_hex();
});

function show_hex(){
$(".demo").hex({
show: true, // The show option allows you to specifiy if you want to show or hide the element.
direction: "left", // "right", "left", "up", "down", "random", "center"
background: "#0769ad", // The background option allows you to change the color of the hexagons
duration: 5, // The duration option allows you to set how long it takes for hexagons to start vanishing. 
delay: 0, // The amount of time in ms until the animation will run. For example 
callback: function(){setTimeout("hide_hex()",5000);} // The callback option lets you run a function once the animation has finished. 
});
}

function hide_hex(){
$(".demo").hex({
show: false, 
direction: "left", 
background: "#0769ad", 
duration: 5, 
delay: 0, 
callback: function(){setTimeout("show_hex()",5000);}
});
}
</script>

This awesome jQuery plugin is developed by motorlatitude. For more Advanced Usages, please check the demo page or visit the official website.