<div id="wrap">
<div class="box" id="home">
<h3>Home</h3>
</div>
<div class="box" id="contact">
<h3>Contact</h3>
</div>
<div class="box" id="fun">
<h3>For Fun</h3>
</div>
<div class="box" id="about">
<h3>About</h3>
</div>
<div class="box" id="website">
<h3>Website</h3>
</div>
<div class="box" id="skill">
<h3>Skills</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</div>
<ul id="nav">
<li><a class="active" href="#home">Home</a></li>
<li><a href="#website">Website</a></li>
<li><a href="#fun">For Fun</a></li>
<li><a href="#about">About</a></li>
<li><a href="#skill">Skills</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
//Adding ScrollTo Plugin, Update Size by Window Size
$(function() {
$('html, body').css('overflow', 'hidden');
function updateSize() {
var winWidth = $(window).width(),
winHeight = $(window).height(),
wrapSum = $('.box').siblings().length;
$('#wrap').css({
width:winWidth*(wrapSum/2),
height:winHeight*(wrapSum/3)
});
$('.box').css({
width:winWidth,
height:winHeight
});
} updateSize();
$(window).resize(function() {
updateSize();
});
$('ul#nav a').click(function () {
$('a.active').removeClass('active');
$(this).addClass('active');
$('html, body').scrollTo($(this).attr('href'), 1000);
return false;
});
});
/**
* jQuery.ScrollTo
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 5/25/2009
*
* @projectDescription Easy element scrolling using jQuery.
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
* Works with jQuery +1.2.6. Tested on FF 2/3, IE 6/7/8, Opera 9.5/6, Safari 3, Chrome 1 on WinXP.
*
* @author Ariel Flesler
* @version 1.4.2
*
* @id jQuery.scrollTo
* @id jQuery.fn.scrollTo
* @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
* The different options for target are:
* - A number position (will be applied to all axes).
* - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
* - A jQuery/DOM element ( logically, child of the element to scroll )
* - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
* - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
* - A percentage of the container's dimension/s, for example: 50% to go to the middle.
* -...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.