jQuery code

Hi

I need to add this code to my html so it shows a little knowledgebase icon on my website. https://www.commissionit.co.uk

<!--Zepto can be replaced with jQuery-->
<script text="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.min.js"></script>
<script type="text/javascript">
(function(d,s,id){var onLoad=function(){SB.Widget.initialize("kb",{siteUrl:"https://commissionit.supportbee.com/1574-commission-it-knowledge-base",iconColor:"#000000",textColor:"#FFFFFF"});};var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return;}js=d.createElement(s);js.id=id;js.onload=onLoad;js.src="https://ddon89rxjwbw8.cloudfront.net/assets/sb_embeddable_hive.js";if (!fjs) document.body.append(js);else fjs.parentNode.insertBefore(js, fjs);}(document,"script","supportbee-jswidget"));
</script>```

where/how do i add the code?

Hi Amin,

Thanks for reaching out.

You can add it to your child theme’s functions.php like this

add_action( 'wp_footer', 'zepto_script', 999999 );

function zepto_script () { 

//prevent it from executing within the builder to prevent more issues 
if ( ! isset( $_POST['cs_preview_state'] ) ) : ?>

<!--Zepto can be replaced with jQuery-->
<script text="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.min.js"></script>
<script type="text/javascript">
(function(d,s,id){var onLoad=function(){SB.Widget.initialize("kb",{siteUrl:"https://commissionit.supportbee.com/1574-commission-it-knowledge-base",iconColor:"#000000",textColor:"#FFFFFF"});};var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return;}js=d.createElement(s);js.id=id;js.onload=onLoad;js.src="https://ddon89rxjwbw8.cloudfront.net/assets/sb_embeddable_hive.js";if (!fjs) document.body.append(js);else fjs.parentNode.insertBefore(js, fjs);}(document,"script","supportbee-jswidget"));
</script>

<?php endif;

}

Thanks!

hi its worked well so thank you…

Is there a way to position the button a little higher on the page? its blocking some navigation button on the website…

https://www.commissionit.co.uk

If not perhaps i can just display this on certain pages, if so how please.

Hi there,

Please try to add this in X > Theme Options > CSS:

a.launcher {
    position: relative;
    top: -40px;
}

Here are some related links for further reading:

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.