1. PROMO Subscribe our All Access Pass @ 75% OFF & access all our 16+ premium Divi extensions: Divi Block Pro, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Solved Anchor on mobile offset

Discussion in 'Free Divi Community Forum' started by Gui, Jul 26, 2020.

  1. Gui

    Gui Member

    1. PRO MEMBER PERKS Divi.Help Pro Layout Packs - Agency Divi layout pack featuring unique comment design on single blog post page:View Demo
  2. Gui

    Gui Member

    I'm all day trying to figure it out and nothing. Already tried the enable alternative scroll, already tried this code and nothing. Ideas? Only thinh that worked was adding padding top to ID's class, but that creates a larger empty space between sections that I don't want..Repeating the issue is just on mobile.

    ps: in chrome dev inspector disabling the fixed positing of the header, the anchors worrk. But I want the fixed header.

    <script> document.addEventListener('DOMContentLoaded', function(event){ if (window.location.hash) { // Start at top of page window.scrollTo(0, 0); // Prevent default scroll to anchor by hiding the target element var db_hash_elem = document.getElementById(window.location.hash.substring(1)); window.db_location_hash_style = db_hash_elem.style.display; db_hash_elem.style.display = 'none'; // After a short delay, display the element and scroll to it jQuery(function($){ setTimeout(function(){ $(window.location.hash).css('display', window.db_location_hash_style); et_pb_smooth_scroll($(window.location.hash), false, 800); }, 700); }); } }); </script>
     
  3. Gui

    Gui Member

    Solved. Ive removed all the custom paddings ive added and now the anchors are at the right place again. upload_2020-7-27_18-26-26.png
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade mega menu design for your Divi site without using any plugins:View Demo