I'm playing with this develop version but I'm wondering how to use jquery in the site.
In a custom page I show some sliders generated by jquery and they are in the middle of the template, generated in php.
Now the jquery library Is in the footer I get the message $jquery not defined.
A picture may help
JQuery
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.
If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.
If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Re: JQuery
Sorry about my English. You surely are calling some JQuery code before it have been loaded. You should keep the JQuery library reference in the <HEAD>.
Regards
Regards
Re: JQuery
Yes I know, then it will work but here at phpbb they decided to put it in the footer.
So how should this ever go to work?
So how should this ever go to work?
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: JQuery
stupid idea keep it where it is and do as Exreaction has instructed or include all code after the Jquery reference in the footer.morgar wrote:Sorry about my English. You surely are calling some JQuery code before it have been loaded. You should keep the JQuery library reference in the <HEAD>.
Regards
If you use Jquery regularly this should be common practice.
- callumacrae
- Former Team Member
- Posts: 1046
- Joined: Tue Apr 27, 2010 9:37 am
- Location: England
- Contact:
Re: JQuery
Load your script after jQuery.John P wrote:Yes I know, then it will work but here at phpbb they decided to put it in the footer.
So how should this ever go to work?
I thought onload_functions was removed? It shouldn't be used anyway.EXreaction wrote:Add functions to onload_functions.
Example:
https://github.com/marc1706/phpbb3/comm ... 8607685b80
- DavidIQ
- Customisations Team Leader
- Posts: 1904
- Joined: Thu Mar 02, 2006 4:29 pm
- Location: Earth
- Contact:
Re: JQuery
Why not?callumacrae wrote:I thought onload_functions was removed? It shouldn't be used anyway.
Re: JQuery
For better understanding, the sliders are in a table generated in a template.
Like the example from Marc I have to output the same information twice. Once for generating the table and once for generating the jquery.
I'm going to move the library in the head, it's more logical.
Like the example from Marc I have to output the same information twice. Once for generating the table and once for generating the jquery.
I'm going to move the library in the head, it's more logical.
- callumacrae
- Former Team Member
- Posts: 1046
- Joined: Tue Apr 27, 2010 9:37 am
- Location: England
- Contact:
Re: JQuery
JavaScript should be loaded after jQuery has been loaded. Then why useDavidIQ wrote:Why not?callumacrae wrote:I thought onload_functions was removed? It shouldn't be used anyway.
onload_functions
when $()
is available?- DavidIQ
- Customisations Team Leader
- Posts: 1904
- Joined: Thu Mar 02, 2006 4:29 pm
- Location: Earth
- Contact:
Re: JQuery
I guess people are used to loading js in the header and this would still allow them to do that? *shrug*
I'm not sure why loading the js in the footer that the OP is wanting to use was a problem. Should have been fine to do so without having to edit any files.
I'm not sure why loading the js in the footer that the OP is wanting to use was a problem. Should have been fine to do so without having to edit any files.