benrowe Posted May 7 Share Posted May 7 Hello, I've implemented custom CSS for a logo in my header, which you can see in the attached photo as a white rectangle. This logo also functions as a smooth scrolling anchor link on desktop browsers. However, I'm encountering an issue on mobile devices where clicking the logo refreshes the page instead of smoothly scrolling to the linked section. Could anyone help me modify the code so that it works correctly on mobile devices as well? Thank you. Link to comment
tuanphan Posted May 9 Share Posted May 9 Can you share site url? We can check logo id easier Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
benrowe Posted May 9 Author Share Posted May 9 Site: foothome.com Password: password123 Please let me know if this works. Thanks! Link to comment
tuanphan Posted May 11 Share Posted May 11 (edited) Use this new code to Code Injection > Footer <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script> <script> $(document).ready(function(){ $('header#header .header-title a').attr('href','#top'); }); </script> Edited May 17 by tuanphan update code Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
benrowe Posted May 13 Author Share Posted May 13 This worked, but now my anchor-linked navigation titles also bring me to the top. Please check my site to see what I mean. Is there a way to apply this code so it only affects the image/logo, and no the titles. I greatly appreciate the help. Link to comment
tuanphan Posted May 17 Share Posted May 17 I updated above code. You can add it again. Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
benrowe Posted May 21 Author Share Posted May 21 On 5/10/2024 at 11:16 PM, tuanphan said: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script> <script> $(document).ready(function(){ $('header#header .header-title a').attr('href','#top'); }); </script Thanks for your reply. Unfortunately, I've tried this code and it doesn't seem to work. See image here of the code being added to my website footer. You can also check the site to see that my header titles are still incorrecly anchor linked due to this. Any idea on how to fix this? Maybe another code. Thanks again for your help. I really appreciate it. Link to comment
benrowe Posted May 21 Author Share Posted May 21 I also tried the code in the header. Is this code supposed to go in the header or footer? Or both? I think there are two scripts conflicting. The other menu links don't seem to work if we have this code. As mentioned before, I am looking to retain the original menu links that I had previously, while having this code allow for my mobile logo to be anchor linked. Link to comment
Solution tuanphan Posted May 21 Solution Share Posted May 21 remove this red box code, unless they will conflict together Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
benrowe Posted May 22 Author Share Posted May 22 I beleive this worked! Thank you very much. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment