• Hi all,

    I’m having a little bit of difficulty understanding why my scroll to thing (where you click a link and it scroll to a certain part of the page) isn’t working…

    It works great in firefox and chrome, ok but not that good on safari all three on desktop but will not work at all on iphones, ipads, android mobiles or when using the firefox developers tools and setting the desktop browsers to ipad/mobile sizes.

    I am using Divi 2.1 as the theme and using a child theme to customise and on wordpress version 4.2.2. My website is http://www.josiefox.com and the button in question is the ‘learn more’ button on the homepage. It is supposed to jump to the section directly below where the red icons start.

    Any ideas, suggestions?

    Thanks,

    Josie.

    [Moderator note: Please don’t bump. If you require urgent support (as would suggest from bumping after 1 minute) then consider hiring someone at WP Jobs]

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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);
          }
    Thread Starter josiefox

    (@josiefox)

    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.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Scrolling Issue’ is closed to new replies.