Offset on mobile
-
Hello,
Can you help me please with offset for mobile? On desktop si good but not on mobile.
Thank you.
The page I need help with: [log in to see the link]
-
Hello,
The smooth scrolling you see on mobile happens via your theme (script:
...themes/Divi/js/scripts.min.js) which doesn’t have a specific offset (that’s why it doesn’t seem to work on mobile).Try adding the class
et_smooth_scroll_disabledon your menu link items (enable “CSS Classes” optional field in menu editor) and let me know so I can check it again.You might also need to add this PHP code in your theme/child-theme functions.php:
function ps2id_custom_script(){ wp_register_script( 'ps2id-custom-script', '', array('jquery'), '', true ); wp_enqueue_script( 'ps2id-custom-script' ); wp_add_inline_script( 'ps2id-custom-script', '(function($){ $(function(){ $("#et_mobile_nav_menu").addClass("et_smooth_scroll_disabled"); }); })(jQuery);'); } add_action( 'wp_enqueue_scripts', 'ps2id_custom_script' );Let me know
Thank you very much. PHP code work well.
I have another problem with highlight on mobile.
I put this CSS but don’t work well. On the second web work. I dont’t know why.@media screen and (max-width: 979px) {
a.mPS2id-highlight{
background: #0c71c3;
}}Can you disable back “Allow only one highlighted element at a time” and “Highlight by next target” options in plugin settings?
Now is better but when I click on item – Kontakt on mobile, then I have highlight with item – Čiernenie. When I click on item – Čiernenie there is no highlight.
On tablet when I click on item – Úvod there is highlight with item – O nás.
I can’t reproduce these issues on mobile. When I click/scroll to Kontakt or Čiernenie the appropriate link is highlighted (when I open the mobile menu again). Did you fix it or?
If your testing tablet has enough vertical resolution, then you might see both Úvod and O nás get highlighted because both sections will be within the user’s visible field. If you want to highlight only the clicked link, you should use the class
.mPS2id-clickedin the CSS. Does this help?.mPS2id-clicked is good for mobile and tablet. Thank you very much for help. Now is all perfect. Happy new year 🙂
You’re welcome 🙂 Happy new year!
Hello,
I have another problem. On the site – https://www.virtualnarealitasr.sk I have different page – Hry a návody. On this page don’t work highlight. Can you help me please?Hello again! I think you just need to add the highlight styling on the current-page menu items that are not handled by the plugin. Try adding the following to your CSS:
#top-menu li.current-menu-item > a:not(._mPS2id-h){ background: blueviolet; padding-top: 15px; margin-top: -20px; }Your code don’t work but I contacted Divi support and they gave me code wich work.
@media screen and (max-width: 980px) {
li#menu-item-2645.current-menu-item {
background: blueviolet;
}}Thank you again 🙂
You’re welcome 🙂
The topic ‘Offset on mobile’ is closed to new replies.