How can I make a mobile banner clickable in Craft Theme?

How can I make a mobile banner clickable in Craft Theme?

Ana281
Tourist
5 0 1

Hello, I use a code CSS that made my banner Clickable on Desktop but do not work on Mobile, how Can I make banner clickable on mobile?Craft Theme

Replies 2 (2)

Small_Task_Help
Shopify Partner
782 26 70

Hi,

 

Identify Your Banner Element (example - #banner)

Edit Code-->at Add JavaScript

 

document.addEventListener('DOMContentLoaded', function() {
    var banner = document.getElementById('banner');
    if (banner) {
        banner.addEventListener('click', function() {
            window.location.href = 'YOUR_TARGET_URL'; // Replace 'YOUR_TARGET_URL' with the URL you want to redirect users to.
        });
    }
});

Save and Test

To Get Shopify Experts Help, E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Expert Agency
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad

niraj_patel
Shopify Partner
2378 514 511

Hello @Ana281 
Hope you are doing well.

Would you like to share your store URL Please ( with password if password protected ) so I can provide you some precise solution for this one

Thank you and looking forward to hearing from you.

Shopify Partner || Helping eCommerce Stores
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution.
- For further discussion contact: Email ID- info@techlyser.com