views:

449

answers:

2

can you load swfobject.js or jquery.swfobject in the footer, below the div being replaced?

I'd love to keep all of my javascript loading at the bottom of the page but swfobject seems to fail if it isn't loaded before any divs to be replaced.

bare bones example:

<div id="flash"></div>

<div id="footer">
    <script src="/static/default/default/js/jquery-1.3.2.min.js"></script>
    <script src="/static/default/default/js/jquery.swfobject.1-0-9.min.js"></script>

       <script type="text/javascript">
         $(document).ready(   
           function () { 
              $('#flash').flash({ swf: 'test.swf' });
            });
         </script>

</div>
A: 

http://medero.org/tests/jquery/flash/swfobject/

This is working for me.. are you sure it isn't a user error? Such as a rewrite rule messing up the flash path, or a typo in the flash path, or the flash wasn't uploaded, etc.

And $(function(){} is a shortcut for document ready, which you shouldn't really need, since the DOM element already exists.

meder
A: 

Got it -

Meder was right no need for document ready. Needed to have function called as a jquery function then:

$(function() ....

instead of function() ....

gary
I undeleted my answer because I was making sure, you shouldn't need the `$(function(){})` though.
meder