#222 new
deborah

scripts don't work if included in body tag instead of head

Reported by deborah | July 16th, 2009 @ 12:23 AM

Hi -

I've seen some group posts that suggest that removing the reference to "head" in line 49 in the current sriptaculous.js as follows

$$('script[src]').findAll(function(s) {

... should solve this problem, but although I did this and am hosting all files locally (not through Google API), scriptaculous is still broken unless it and all associated scripts are in the head.

I'm using scriptaculous 1.8.2 with Prototype 1.6.1_rc3, for Nick Stackenburg's Lightview application. Scriptaculous and prototype manage the animation of the lightbox - when it's broken, the image just becomes a static link and does not animate in a lightbox.

It will really slow down our site to put the scripts in the head - it's a Drupal site that only uses Scriptaculous, Prototype and Lightview on a very few pages, and the head is already complex and full of scripts to communicate with a separate website application.

Previously it did work in the body - please help? I don't want to clutter pages that don't need it with still more script in the complicated head.

Thank you for your aweseome stuff, Deborah

Comments and changes to this ticket

  • Dan Dean

    Dan Dean July 17th, 2009 @ 12:02 AM

    Since most of what sriptaculous.js does is simply inject script elements for other scripts into the page, you could work around this is by not using sriptaculous.js and instead just include the desired Sriptaculous files manually, like this:

    <script type="text/javascript" src="path/to/builder.js"></script>
    <script type="text/javascript" src="path/to/effects.js"></script>
    <script type="text/javascript" src="path/to/dragdrop.js"></script>
    <script type="text/javascript" src="path/to/controls.js"></script>
    <script type="text/javascript" src="path/to/slider.js"></script>
    

    You probably only actually need effects.js though...

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours.
<br/><b>Source available from github</b>
The Git repository resides at:
<a href="http://github.com/madrobby/scriptaculous">http://github.com/madrobby/scriptaculous</a>
<br/>Check out the current development trunk with:
<code>git clone git://github.com/madrobby/scriptaculous.git</code>
<br/>As <b>script.aculo.us 1.xx is feature-frozen</b>, this development trunk is for <b>bugfixes only</b>.
<br/>New development should happen only for
<b>script.aculo.us 2</b>.
<br/><b>Creating a bug report</b>
When creating a bug report, be sure to include as much relevant information as possible. Post a an example that shows off the problem. Preferably, <b>alter the unit tests</b> and show through either changed or added tests how the expected behavior is not occuring.

People watching this ticket

Referenced by

Pages