Adding your javascript
Permalink Browser Info Environment
Hi
I have just tried this and I'm excited with the possiblities.
I'm looking to create a rotating testimonial block. I've added my markup and view css file and works fine but I'm a bit confused by how I get the java script running.
What do I put in the js file? How do I reference the jquery scripts for the plugin ect?
Any guidence on this would be very helpful and appreciated :)
Cheers, Matt
I have just tried this and I'm excited with the possiblities.
I'm looking to create a rotating testimonial block. I've added my markup and view css file and works fine but I'm a bit confused by how I get the java script running.
What do I put in the js file? How do I reference the jquery scripts for the plugin ect?
Any guidence on this would be very helpful and appreciated :)
Cheers, Matt
Type: | Discussion |
---|---|
Status: | New |
Thanks Jordan for your speedy reply and easy to follow instructions. I got it working now!
http://botticreative.co.uk/demo/about/...
This plugin is amazing! :)
Cheers, Matt
http://botticreative.co.uk/demo/about/...
This plugin is amazing! :)
Cheers, Matt
The simplest thing to try is to just create a directory in the block folder called "js". (This would be a new folder next to the existing "view.php" file... for example, if your block handle was "rotating_testimonals", you would create the directory "SITEROOT/blocks/rotating_testimonials/js/").
Any .js files you put in there should be automatically loaded by C5. Note that it only looks at the top-level of that "js" directory... not in subfolders within.
That being said, note that if you have two different blocktypes that both use the same javascript library, and blocks of both those types are placed on the same page, you might run into conflicts... if that situation arises, let me know and I can go into more complicated solutions for that particular situation.
Another tricky situation is some js libraries have a lot of related assets (sub-folders with more js files, related css and image files, etc.). Let me know if that's the case also and we can try some other things as well.
But 90% of the time, the simple "place them in the 'js' directory" solution works, so try that first.
Let me know how it goes!
-Jordan