Skip to content

Commit

Permalink
resolving revert conflict. removing smooth scroll as it was buggy wit…
Browse files Browse the repository at this point in the history
…h short pages or tall browsers. explore section collapsing mostly deals with root issue.
  • Loading branch information
paulirish committed Mar 5, 2012
1 parent 63d7e70 commit 7c09f59
Showing 1 changed file with 3 additions and 29 deletions.
32 changes: 3 additions & 29 deletions js/script.js
Expand Up @@ -25,11 +25,7 @@ var ies = ['gtie6', 'gtie7', 'gtie8', 'gtie9', 'gtie10'];

var search = document.getElementById('livesearch'),
searchresults = document.querySelectorAll('.features article'),
searchurl = document.getElementById('searchurl'),
articlecontainer = document.querySelector('.explore-features'),
originaltop = articlecontainertop = +articlecontainer.getBoundingClientRect().top,
moredetailscontainer = document.getElementById('moredetails'),
lastActiveHash = null;
searchurl = document.getElementById('searchurl');

[].map.call(searchresults, function(result) {
var tags = result.querySelector('.tags'),
Expand Down Expand Up @@ -131,36 +127,14 @@ function showsearch(hash) {
search.value = hash;

featureList.search(hash);

currentActiveHash = document.querySelector('a[href="#' + hash +'"]');
lastActiveHash && classList(lastActiveHash).remove('active');
currentActiveHash && classList(currentActiveHash).add('active');
lastActiveHash = currentActiveHash;

repeatscrolling = window.setInterval(function() {
count = count + 10 || 0;
animatescroll(count);
}, 1);
updatesearch();
};

function getYOffset() {
if(window.pageYOffset) {
return window.pageYOffset;
} else {
return (((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.ScrollTop == 'number' ? t : document.body).ScrollTop;
}
};


function animatescroll(yOffset) {
if(getYOffset() > articlecontainertop) {
clearInterval(repeatscrolling);
} else {
window.scroll(0, yOffset);
}
};

// keyboard shortcut for / to go to search box.
addEvent(window, 'keyup', function(e){
if (e.which == 191 && document.activeElement != search)
Expand All @@ -172,8 +146,8 @@ var moredetails = document.getElementById("clickmore");
moredetails.onclick = function(e) {
e || (e = window.event);
var target = e.target || e.srcElement;
articlecontainertop = originaltop + moredetailscontainer.offsetHeight;
classList(target).toggle('active');

classList(target).toggle('active');
classList(document.getElementById(/#(.*)/.exec(target.href)[1])).toggle('active');
e.preventDefault && e.preventDefault();
};

0 comments on commit 7c09f59

Please sign in to comment.