Search code examples
javascriptjqueryjoomlajoomla3.3

Joomla 3.x: How to add or Link to a external javascript file


I want to use a parallax for my Joomla.

Specifically this one: https://github.com/IanLunn/jQuery-Parallax

How can I insert these to my joomla pages.

<script type="text/javascript" src="scripts/jquery.parallax-1.1.3.js"></script>
<script type="text/javascript" src="scripts/jquery.localscroll-1.2.7-min.js"></script>
<script type="text/javascript" src="scripts/jquery.scrollTo-1.4.2-min.js"></script>

I am using this template with Helix Framework

http://demo.joomshaper.com/?template=radon#


Solution

  • The proper way to add Java-Script Libraries in to your Joomla Installation (Template or Components) is explained in Joomla Docs:

    <?php
      $document = JFactory::getDocument();
      $document->addScript('/media/system/js/sample.js');
    ?>
    

    Reference: Adding JavaScript