Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #22499

    Hi, I was looking to make my page mobile responsive in terms of a “call us” feature that only works with mobile phones. I was told to Google it by a BoldGrid support staff on one of the support forums. I did, and planned to add my findings to the answers to my own question to help others (I am sure it is a common need)… However, it turns out the widget editor uses html only. How would I embed javascript into a widget? I have tried methods found online and have not been successful. Please help. I am looking to use the following script in a widget:

    if (is_mobile_device()) {

    <p class=”h3 alt-font”><i class=”fa fa-phone”></i> <a href=”tel:+27726238587″>Call today</a></p>;

    } else {<p class=”h3 alt-font”>Call today<i class=”fa fa-phone”></i></p>;

    }

    #22500
    JohnPaul B
    Member

    Hello Ryan,

    Thank you for contacting us about adding a mobile-specific javascript to a widget area. Unfortunately, WordPress does not have this functionality built-in and BoldGrid does not add this option. There are 3rd party plugins available that allow you to add javascript to widgets such as Widget Options, which actually allows you to create mobile-specific widgets without javascript.

    You could possibly use the Custom JS & CSS editor to add mobile rules, but this will require further coding and testing.

    Thank you,

    John-Paul

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Embedding Javascript into Widget’ is closed to new replies.