Tagged: Fixed image
-
AuthorPosts
-
March 7, 2024 at 2:04 pm #1436621
Hello,
I’m trying to replicate the “whatsapp me” button but I’d like to avoid using plugins that calls external javascript and stuff.
So I was wondering if there is a way to fix an image in the same posizione (eg bottom:120px; right:20px) for the whole site and link that image.
I’m trying to put it in the footer but other elements are above it and I’m not able to bring it above even changing the z-index.
Any suggestion?
Thank youMarch 7, 2024 at 4:02 pm #1436636Hey SurigliaStudio,
Did you add the element in question to your site already? If so, then please post a link to where we can see it.
Best regards,
RikardMarch 7, 2024 at 4:29 pm #1436647Hello Rikard,
I just added the image on the site
It’s in the footer as you can see
and I assign it a class .wa_imgMarch 7, 2024 at 5:50 pm #1436652can you put this in your child-theme functions.php:
function insert_a_whatsapp_button() { ?> <script> (function($){ $( '#top' ).append('<div class="whatsapp-button"><a href="https://wa.me/3483883844?text=Salve,%20vorrei%20chiedere%20informazioni" target="_blank"><img width="80" height="80" src="https://srgl.it/aom/wp-content/uploads/2024/03/whatsapp_img-80x80.png" class="image wp-image-864 wa_img attachment-thumbnail size-thumbnail" alt="" style="max-width: 100%; height: auto;" decoding="async" srcset="https://srgl.it/aom/wp-content/uploads/2024/03/whatsapp_img-80x80.png 80w, https://srgl.it/aom/wp-content/uploads/2024/03/whatsapp_img-36x36.png 36w, https://srgl.it/aom/wp-content/uploads/2024/03/whatsapp_img.png 149w" sizes="(max-width: 80px) 100vw, 80px"></a></div>'); $('.whatsapp-button').css({ "position": "fixed", "bottom": "120px", "right": "20px", "z-index": "500", }) })(jQuery); </script> <?php } add_action('wp_footer', 'insert_a_whatsapp_button');
March 7, 2024 at 7:07 pm #1436666Hi,
Thanks for the update. Did you try the code posted by @guenni007, and did you have any luck with it?
Best regards,
RikardMarch 7, 2024 at 9:14 pm #1436681Hello,
Thank you Guenni007, the code works fine for me :)
You can close the ticket
AMarch 8, 2024 at 10:11 am #1436718Hi,
Great, I’m glad to hear that you got it working. Please open a new thread if you should have any further questions or problems.
Best regards,
Rikard -
AuthorPosts
- The topic ‘Fix an image in a position in every page’ is closed to new replies.