Difference between revisions of "Team:ATOMS-Turkiye/shortcut"
(2 intermediate revisions by the same user not shown) | |||
Line 65: | Line 65: | ||
function scrollOpen(id){if($(id)==undefined)return; | function scrollOpen(id){if($(id)==undefined)return; | ||
$('html, body').animate({ | $('html, body').animate({ | ||
− | scrollTop: $(id).offset().top- | + | scrollTop: $(id).offset().top-100 |
},0); | },0); | ||
$(id).click();} | $(id).click();} |
Latest revision as of 14:19, 2 October 2015
$('.post__article').scrollNav({ sections: 'h2.scroll', subSections: true, sectionElem: 'div', showHeadline: false, headlineText: 'Scroll To', showTopLink: true, topLinkText: 'Top', fixedMargin: 40, scrollOffset: 140, animated: true, speed: 500, insertTarget: this.selector, insertLocation: 'insertBefore', arrowKeys: false, scrollToHash: true, onInit: null, onRender: null, onDestroy: null
}); var $; var observer_target = document.querySelector('.post__article'); var observer = new MutationObserver(function(mutations) {
mutations.forEach(function() { $.fn.scrollNav('resetPos'); });
}); var observer_config = {
attributes: true, childList: true, characterData: true, subtree: true
}; observer.observe(observer_target, observer_config);
$('.box').hide();
// Make sure all the elements with a class of "clickme" are visible and bound // with a click event to toggle the "box" state $('.clickme').each(function() {
$(this).show(0).on('click', function(e) { // This is only needed if your using an anchor to target the "box" elements e.preventDefault(); // Find the next "box" element in the DOM $(this).next('.box').slideToggle('fast'); });
});
function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'none') e.style.display = 'inline'; else e.style.display = 'none'; }
$(function(){ $("#headerWrapper").sticky({topSpacing:51}); $("nav.scroll-nav").sticky({topSpacing:74}); });
function scrollOpen(id){if($(id)==undefined)return; $('html, body').animate({
scrollTop: $(id).offset().top-100 },0);
$(id).click();}
$(function(){
scrollOpen(window.location.hash);
});