开发者

can you load swfobject.js or jquery.swfobject in the footer

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="te开发者_开发问答xt/javascript">
         $(document).ready(   
           function () { 
              $('#flash').flash({ swf: 'test.swf' });
            });
         </script>

</div>


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.


Got it -

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

$(function() ....

instead of function() ....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜