Load Javascript on homepage pagetype

Permalink
I'm trying to load a Jquery plugin only on the homepage (I have created a pagetype for the homepage)

The plugin had been loaded to the root/js folder "bjqs-1.3.js"

This is my code in the homepage template:
<?php 
defined('C5_EXECUTE') or die("Access Denied.");
$this->inc('elements/header.php'); ?>
    <?php
        $html = Loader::helper('html');
        $this->addHeaderItem($html->javascript('bjqs-1.3.js'));
    ?>
      <article id="hero">
                  <?php 
               $a = new Area('HERO');
               $a->display($c);
            ?>
     </article>
     ..............


Im trying to load the plugin using the helper as shown above, but i dont think I am doing this correctly?

I understand I could ajust all the page templates so that the HEAD is closed within the actule page template type and just put the call there, however I dont think this would be "Good practice". The other option would be to call a custom header2.php file.

An guidance on the best approach appreciated.

Thanks in advance

 
Blenderite replied on at Permalink Reply
Blenderite
There is no need to load JQuery. It is loaded by default. Loading it again will only cause you pain, trust me I know.
biscutty replied on at Permalink Reply
Thanks obc, but you should be able to see that I am not trying to load jquery, but rather a jquery plugin.
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Page Properties> Custom Attributes> Header Extra Content.
You could add it as a link to the file or inline it by pasting the code right there.
INTcommunications replied on at Permalink Reply
INTcommunications
Kind of interested how to get this yo work also - tried it in a footer and it worked but the dashboard disappeared so I took it out,
Blenderite replied on at Permalink Reply
Blenderite
The reason dashboard disappeared, is because of a conflict with JQuery.