The same .js file outputting multiple times from different block templates
Permalink
Hi There,
We have a slider that is used with two different block templates but when both templates are used on the same page, the .js initialisation file loads twice from two different locations:
We're thinking of putting the initialisation .js into the footer of every page and somehow using php to check the page for div.slider before outputting - can php do this or is it better to use jquery?
We just don't want the initialisation code to run unless div.slider is on the page.
Cheers
Ben
We have a slider that is used with two different block templates but when both templates are used on the same page, the .js initialisation file loads twice from two different locations:
/blocks/page_list/templates/related_pages/js/slider.js /blocks/page_list/templates/slider/js/slider.js
We're thinking of putting the initialisation .js into the footer of every page and somehow using php to check the page for div.slider before outputting - can php do this or is it better to use jquery?
We just don't want the initialisation code to run unless div.slider is on the page.
Cheers
Ben