The reason it doesn’t work on Firefox developer tools testing mobile sizes is because your jQuery conditional requires that the main-header not have the class “et-fixed-header,” the body has the class “et_fixed_nav,” and the window width is greater than 980 in order to do the scroll, and at mobile sizes in Firefox at least, those conditions are not met, so the code to scroll is not executed. I can’t test the other platforms/browsers you list, but the same may be the case there.
if (!$('#main-header').hasClass('et-fixed-header') && $('body').hasClass('et_fixed_nav') && $(window).width() > 980) {
setTimeout(function() {
et_pb_smooth_scroll(target, false, 200);
}, 500);
}
Thank you for your reply!
Is there anyway I can fix this easily?
Define “easily.” : )
If you want to retain the smooth-scrolling effect, you could play with the conditional above to see if allowing the scrolling causes problems if the main-header has the “et-fixed-header,” if the body has the class “et_fixed_nav,” or if the window width is less than 980 by altering that statement accordingly and testing on the various platforms you have access to. I’d start by commenting out the entire conditional and just running the meaty part:
//if (!$('#main-header').hasClass('et-fixed-header') && $('body').hasClass('et_fixed_nav') && $(window).width() > 980) {
setTimeout(function() {
et_pb_smooth_scroll(target, false, 200);
}, 500);
//}
Then, take a look at it using Firefox in the Responsive Design View to see if anything blows up. (Remember to clear your browser cache after changing the jQuery each time with Ctrl+F5.) If it doesn’t, then you could try it that way on other platforms to see if it works without causing problems.
It’s possible the developer put it in there because running the code in those circumstances causes a problem, or maybe not. If you can’t contact the developer and find out, testing is the best way to determine whether or not those limitations are necessary.
The other thing you could do is just add a named anchor where you want the user taken to and comment out the code block that intercepts it, because with the code still present a regular named anchor won’t work, but you’ll lose the smooth scrolling.