How to Add custom Jquery to my template
8 years 10 months ago #35472
by dries
How to Add custom Jquery to my template was created by dries
Hello.
I am trying to add custom jquery to my template.
If someone could please help me with this, I would be extremely grateful.
Where should I place my script tags?
EG -
<script src=" ajax.googleapis.com/ajax/libs/jquery/2.2.3/jquery.min.js ">
<script src="assets/js/jquery-2.2.3.min.js "></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/main.js"></script>
I adding custom code within template creator ck that references my file that i created in my locahost file structure
If I create a folder in the template with the files, it just keeps getting overwritten when I copy new changes into the template.
Thank you in regards.
I am trying to add custom jquery to my template.
If someone could please help me with this, I would be extremely grateful.
Where should I place my script tags?
EG -
<script src=" ajax.googleapis.com/ajax/libs/jquery/2.2.3/jquery.min.js ">
<script src="assets/js/jquery-2.2.3.min.js "></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/main.js"></script>
I adding custom code within template creator ck that references my file that i created in my locahost file structure
If I create a folder in the template with the files, it just keeps getting overwritten when I copy new changes into the template.
Thank you in regards.
Please Log in or Create an account to join the conversation.
8 years 10 months ago #35478
by ced1870
Joomlack Webmaster and Developer
Replied by ced1870 on topic How to Add custom Jquery to my template
Hi
you can keep this
to add in the Parameters >> custom code
your files shall be kept in place if you put them directly into the template folder
CEd
you shall never do that. jQuery is included into Joomla! so you must call it using the API<script src="ajax.googleapis.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<script src="assets/js/jquery-2.2.3.min.js "></script>
<script src="assets/js/bootstrap.min.js"></script>
Code:
JHtml::_('jquery.framework');
you can keep this
Code:
<script src="assets/js/main.js"></script>
your files shall be kept in place if you put them directly into the template folder
CEd
Joomlack Webmaster and Developer
Please Log in or Create an account to join the conversation.
8 years 10 months ago #35479
by dries
Replied by dries on topic How to Add custom Jquery to my template
Hello.
Thank you very much for your response.
Please see my attached screenshots.
I am not sure where to place the javascript file.
1 ) is it in root/templates/mytemplate/js/main.js
or
2 ) is it in root/components/com_templateck/projects/mytemplate/js.
If I put it in nr 2 and I make changes and copy it into the template it keeps being deleted.
Im also not sure where to call the api:
JHtml::_('jquery.framework');
I apprecite your help more than you can imagine.
Thank you so much.
Thank you very much for your response.
Please see my attached screenshots.
I am not sure where to place the javascript file.
1 ) is it in root/templates/mytemplate/js/main.js
or
2 ) is it in root/components/com_templateck/projects/mytemplate/js.
If I put it in nr 2 and I make changes and copy it into the template it keeps being deleted.
Im also not sure where to call the api:
JHtml::_('jquery.framework');
I apprecite your help more than you can imagine.
Thank you so much.
Please Log in or Create an account to join the conversation.
8 years 10 months ago #35505
by ced1870
Joomlack Webmaster and Developer
Replied by ced1870 on topic How to Add custom Jquery to my template
you should be able to put your js file directly in the template (solution No 1)
for your code, this is correct (what I see on the picture), to call jQuery and then your script. only the path to your script is not correct
you can check my cheatsheet to help you
www.joomlack.fr/en/joomla-documentations...templates-cheatsheet
for your code, this is correct (what I see on the picture), to call jQuery and then your script. only the path to your script is not correct
you can check my cheatsheet to help you

www.joomlack.fr/en/joomla-documentations...templates-cheatsheet
Joomlack Webmaster and Developer
The following user(s) said Thank You: dries
Please Log in or Create an account to join the conversation.
8 years 10 months ago #35506
by dries
Replied by dries on topic How to Add custom Jquery to my template
Thank you very much.
I will go and try to figure this out more.
Dries
I will go and try to figure this out more.
Dries
Please Log in or Create an account to join the conversation.
8 years 10 months ago #35511
by dries
Replied by dries on topic How to Add custom Jquery to my template
Ok, so I figured it out and now works.
I have attached screenshots.
Hopefully this helps someone else out who is struggling...
My issue was with using '$' instead of 'jQuery' as well as referencing of the script file.
Thank you for your help.
Regards
I have attached screenshots.
Hopefully this helps someone else out who is struggling...
My issue was with using '$' instead of 'jQuery' as well as referencing of the script file.
Thank you for your help.
Regards
The following user(s) said Thank You: ced1870
Please Log in or Create an account to join the conversation.
Time to create page: 0.222 seconds