Skip to content

Commit

Permalink
redirect-counter-plugin v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DevWL committed Jan 4, 2016
0 parents commit d2fb5e6
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Could not open input file: echo
52 changes: 52 additions & 0 deletions css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@keyframes gjPulse {
0% {
width: 90px;
height: 90px;
}
25% {
width: 105px;
height: 105px;
}
50% {
width: 130px;
height: 130px;
}
75% {
width: 110px;
height: 110px;
}
100% {
width: 90px;
height: 90px;
}
}

#gj-counter-box{
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
opacity: 0.2;
width: 90px;
height: 90px;
background-color: rgb(183, 0, 0);
border-radius: 50%;
border:6px solid white;
visibility: none;
display: none;
animation: gjPulse 1s linear infinite;
}
#gj-counter-box:hover{
opacity: 1;
cursor: pointer;
}
#gj-counter-num{
position: relative;
text-align: center;
margin: 0px;
padding: 0px;
top:50%;
transform: translate(0%, -50%);
color: white;


}
22 changes: 22 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5 basic skeleton</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/custom.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<h1>WITAJCIE!</h1>
<div id="gj-counter-box">
<h1 id="gj-counter-num"></h1>
</div>
</body>
</html>
49 changes: 49 additions & 0 deletions js/custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// FUNCTION CODE
function gjCountAndRedirect(secounds, url)
{

$('#gj-counter-num').text(secounds);

$('#gj-counter-box').show();

var interval = setInterval(function()
{

secounds = secounds - 1;

$('#gj-counter-num').text(secounds);

if(secounds == 0)
{

clearInterval(interval);
window.location = url;
$('#gj-counter-box').hide();

}

}, 1000);

$('#gj-counter-box').click(function()
{
clearInterval(interval);
window.location = url;

});
}

// USE EXAMPLE
$(document).ready(function() {
//var
var gjCountAndRedirectStatus = false; //prevent from seting multiple Interval

//call
$('h1').click(function(){
if(gjCountAndRedirectStatus == false)
{
gjCountAndRedirect(10, document.URL);
gjCountAndRedirectStatus = true;
}
});

});

0 comments on commit d2fb5e6

Please sign in to comment.