I made this website: bosd.eu. It has a javascript / jQuery piece that focuses on the correct area of ββthe page when clicked.
However, when I use Firefox, neither mobile nor desktop work.
So, should this be javascript right?
var initSmoothScroll = function(){
$('.scroll').click(function () {
doScroll($(this))
});
};
var doScroll = function($element){
$('body').animate({
scrollTop: $('#' + $element.attr('target')).offset().top - 10
}, 300);
};
$(window).scroll(function() {
if ($(window).scrollTop() > 100) {
$('#topbutton').fadeIn('slow');
}
else {
$('#topbutton').fadeOut('fast');
}
});
Here's how it is processed in HTML:
<a class="scroll" target="story" id="storybutton"><h1>ABOUT</h1></a>
I found this while searching, but he did not give me an answer:
source
share