Skip to content

Commit

Permalink
fixed "skip intro" scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
SimoPcLorena committed Aug 27, 2012
1 parent baa5f96 commit 702d655
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 58 deletions.
16 changes: 13 additions & 3 deletions public/js/script.js
Expand Up @@ -158,9 +158,8 @@ $(function(){
// alert('music playing');
}

$('#intro-wrapper').fadeOut('slow'); // tempo che ci mette il wrapper a scomparire
$('body').css('overflow', 'visible');

// $('#intro-wrapper').fadeOut('slow'); // tempo che ci mette il wrapper a scomparire

});

/*
Expand Down Expand Up @@ -194,4 +193,15 @@ $(function(){
});


});



function scrollToContent() {
console.log('function executed');
$('html').animate({ scrollTop: $('#intro-wrapper').height() }, "slow");

}
$('#skip-intro').on('click', function(){
scrollToContent();
});
115 changes: 60 additions & 55 deletions public/js/scroll.js
@@ -1,57 +1,62 @@
$(document).ready(function() {

$(window).scroll(function() { // biography fix when scrolling up
console.log($('html').offset().top);
if ( $('html').offset().top == 0 ) {
$('#navbar').find('.current').removeClass('current');
$('#navbar ul li a[href^="#bio"]').addClass('current');
}
});


// var gOffset = 0;


$('section').waypoint(function(event, direction) {

var id = $(this).attr('id');
//console.log('id: '+$(this).attr('id')+', direction: '+direction);
$('#navbar').find('.current').removeClass('current');
$('#navbar ul li a[href="#'+id+'"]').addClass('current');

// console.log('id: '+$(this).attr('id')+', direction: '+direction);
// gOffset = direction === 'down' ? 160 : 0;
// $.waypoints('refresh');

// console.log(gOffset);
//console.log($('html').offset().top);

}, {
offset: 160
});



/*
$(document).scrollTop(0); // quick reset in case user refreshes the page
var OFFSET = 30;
var HEADER_HEIGHT = parseInt($('#header').height()) + OFFSET;
$('a[href^=#]:not([href=#])').click(function(e){
$('html, body')
.animate({
scrollTop: $($(this).attr("href"))
.offset().top - HEADER_HEIGHT }, 1200)
.animate({
scrollTop: $($(this).attr("href"))
.offset().top - HEADER_HEIGHT - 20 }, 300)
.animate({
scrollTop: $($(this).attr("href"))
.offset().top - HEADER_HEIGHT }, 600);
e.preventDefault();
});
*/





$((function() {

$(window).scroll(function() { // biography fix when scrolling up
console.log($('html').offset().top);
if ( $('html').offset().top == 0 ) {
$('#navbar').find('.current').removeClass('current');
$('#navbar ul li a[href^="#bio"]').addClass('current');
}
});


// var gOffset = 0;


$('section').waypoint(function(event, direction) {

var id = $(this).attr('id');
//console.log('id: '+$(this).attr('id')+', direction: '+direction);
$('#navbar').find('.current').removeClass('current');
$('#navbar ul li a[href="#'+id+'"]').addClass('current');

// console.log('id: '+$(this).attr('id')+', direction: '+direction);
// gOffset = direction === 'down' ? 160 : 0;
// $.waypoints('refresh');

// console.log(gOffset);
//console.log($('html').offset().top);

}, {
offset: 160
});



/*
$(document).scrollTop(0); // quick reset in case user refreshes the page
var OFFSET = 30;
var HEADER_HEIGHT = parseInt($('#header').height()) + OFFSET;
$('a[href^=#]:not([href=#])').click(function(e){
$('html, body')
.animate({
scrollTop: $($(this).attr("href"))
.offset().top - HEADER_HEIGHT }, 1200)
.animate({
scrollTop: $($(this).attr("href"))
.offset().top - HEADER_HEIGHT - 20 }, 300)
.animate({
scrollTop: $($(this).attr("href"))
.offset().top - HEADER_HEIGHT }, 600);
e.preventDefault();
});
*/

});

0 comments on commit 702d655

Please sign in to comment.