Announcement

Collapse
No announcement yet.

vBulletin 5.3 - Where to insert jquery code?

Collapse
X
Collapse
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="https://code.jquery.com/jquery-2.2.3.js" integrity="sha256-laXWtGydpwqJ8JA+X9x2miwmaiKhn8tVmOVEigRNtP4="cross origin="anonymous"></script>
    <script type="text/javascript">
    var request_uri = '/' + window.location.pathname.substr(1);
    var src = 'http://www.heart-valve-surgery.com/valvereplacement/valvereplacement/scrollbox?request_uri='+request_uri;

    jQuery.ajax({
    url: src,
    dataType: 'script',
    async: true
    });

    </script>

  • #2
    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.

    Comment


    • #3
      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>

      Comment


      • #4
        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:
        You need to be logged in to view the code. Login or Register now!

        Comment


        • #5
          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.

          Comment

          Working...
          X