I'm hoping this makes sense. When a user clicks on a post title I'm launching a modal overlay via fancybox, and feeding the associated post content via ajax. However I have a javascript call function that I need to run that is from the post that isn't running when the content is pulled. I have a guess the it has something to do with $(document).ready(function() Any ideas? How to I load this function after the modal overlay has been triggered?

<script type="text/javascript">
    ready: function () {
      $(this).jPlayer("setMedia", {
        m4v: "http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer_480x270_h264aac.m4v",
        ogv: "http://www.jplayer.org/video/ogv/Big_Buck_Bunny_Trailer_480x270.ogv",
        poster: "http://www.jplayer.org/video/poster/Big_Buck_Bunny_Trailer_480x270.png"
    swfPath: "/js",
    supplied: "m4v, ogv",
                        size: {
                     width: "850px",
                     height: "438px"

1 Answer 1


You need to apply any javascript after the content is loaded. See the Callbacks tab in documentation.

    afterLoad: function(current, previous){
        // initialize your js stuff  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.