Initial Commit

This commit is contained in:
mathias 2014-11-14 21:48:17 +02:00
parent 41d462fe42
commit 19ac23fd53
3 changed files with 56 additions and 4 deletions

View file

@ -29,8 +29,6 @@
<div id="ip"><div id="ipbox">IP</div><input type="text" value="minecraft.ga" onfocus="this.select();" onmouseup="return false;" size="10"></div> <div id="ip"><div id="ipbox">IP</div><input type="text" value="minecraft.ga" onfocus="this.select();" onmouseup="return false;" size="10"></div>
</div> </div>
</section> </section>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="js/scroll.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="js/minecraft.js"></script>
</body> </body>
</html> </html>

View file

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Minecraft.ga is a server where you can test out whatever you like. Whether it be OP Commands, Command Blocks, or just building, Minecraft.ga gives you freedom."> <meta name="description" content="Minecraft.ga tries to simulate the experience of being an admin or moderator on a server. With access to operator (OP) commands and features used by server staff, you can do heaps of stuff.">
<title>Minecraft.ga - An OP Minecraft Server</title> <title>Minecraft.ga - An OP Minecraft Server</title>
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" type="text/css"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="css/minecraft.css" rel="stylesheet"> <link href="css/minecraft.css" rel="stylesheet">

54
js/scroll.js Normal file
View file

@ -0,0 +1,54 @@
(function() // Code in a function to create an isolate scope
{
var speed = 500;
var moving_frequency = 15; // Affects performance !
var links = document.getElementsByTagName('a');
var href;
for(var i=0; i<links.length; i++)
{
href = (links[i].attributes.href === undefined) ? null : links[i].attributes.href.nodeValue.toString();
if(href !== null && href.length > 1 && href.substr(0, 1) == '#')
{
links[i].onclick = function()
{
var element;
var href = this.attributes.href.nodeValue.toString();
if(element = document.getElementById(href.substr(1)))
{
var hop_count = speed/moving_frequency
var getScrollTopDocumentAtBegin = getScrollTopDocument();
var gap = (getScrollTopElement(element) - getScrollTopDocumentAtBegin) / hop_count;
for(var i = 1; i <= hop_count; i++)
{
(function()
{
var hop_top_position = gap*i;
setTimeout(function(){ window.scrollTo(0, hop_top_position + getScrollTopDocumentAtBegin); }, moving_frequency*i);
})();
}
}
return false;
};
}
}
var getScrollTopElement = function (e)
{
var top = 0;
while (e.offsetParent != undefined && e.offsetParent != null)
{
top += e.offsetTop + (e.clientTop != null ? e.clientTop : 0);
e = e.offsetParent;
}
return top;
};
var getScrollTopDocument = function()
{
return document.documentElement.scrollTop + document.body.scrollTop;
};
})();