No announcement yet.

vBulletin 5.3 - Where to insert jquery code?

First Prev Next Last
  • Filter
  • Time
  • Show
Clear All
new posts

    vBulletin 5.3 - Where to insert jquery code?

    I am trying to add the following code into the footer of my templates and when I do so, it causes the links for replying to a post to disappear from my forum.

    The purpose of this code is to present a popup when a user scrolls down on the page.

    I am inserting it into the Footer for my active templates as shown here.

    Can you please tell me where I should be inserting this code so that it does not prevent the forum from working properly?

    1. I Place this code just above the closing body tag:

    <div id="scrollbox"></div>

    2. I Place this code below the closing html tag:

    <script src="" integrity="sha256-laXWtGydpwqJ8JA+X9x2miwmaiKhn8tVmOVEigRNtP4="cross origin="anonymous"></script>
    <script type="text/javascript">
    var request_uri = '/' + window.location.pathname.substr(1);
    var src = ''+request_uri;

    url: src,
    dataType: 'script',
    async: true


    You don't have to include jQuery as vB5 already has it.

    What does that scrollbox script do? You may not actually need jQuery just to include the scrollbox script.


      When a user scrolls down, it is a popup inviting them to click and participate in a study. Unfortunately I'm a bit of a newb and only had instructions I was provided. Should I give it a shot with only this above the closing body tag? <div id="scrollbox"></div>


        It is recommended not to edit existing vB templates (unless absolutely necessary) as it may caused template merge conflicts every time you upgrade. You would have to resolve those conflicts or the page(s) using that template will stop working.

        What you want to do can be accomplished without editing templates. You can create a template hook in the footer_before_body_end hook location with this code in a new template:

        HTML Code:
        <div id="scrollbox"></div>
        <script type="text/javascript">
        (function() {
            var request_uri = '/' + window.location.pathname.substr(1),
                src = '' + encodeURIComponent(request_uri),
                script = document.createElement('script');
            script.type = 'text/javascript';
            script.async = true;
            script.src = src;


          Thanks - I will look into that and see if I can determine where that is done... At least I have something to look at now.