开发者

Is it possible to explicitly tell a script when to execute, when the page is open dynamically?

I have a page which dynamically opens each page based upon the tags. I am attempting to execute a script, which is to run when the dynamic page is run from the div id="CreateVids" tag.

I'm totally new to this so i'm not too sure what is the problem. I have been looking to see if there is a property of the that I can set but I cannot seem to find it.

Any help would be much appreciated! Thanks a lot!

Sorry Treffynnmon, yes I do have some code

<body>
    <div id="about" class="selectable">
                <p>Developed by Jacob Bowe</p>
                <p><br /><br /><a href="#" class="grayButton goback">Close</a></p>
    </div>
    <div id="Demo">
  开发者_高级运维      <div class="toolbar">
            <h1>Demonstration Video</h1>
            <a class="back" href="#home">Home</a>
        </div>
        <ul class="rounded">
            <center><video id="video1" src="bunny.mp4" width="270" height="180" controls></video></center>
        </ul>
    </div>

<div id="CreateVids">
        <div class="toolbar">
            <h1>Create your own film!</h1>
            <a class="back" href="#">Home</a>
        </div>
        <h2>Put the film clips in any order! Click on proceed to view</h2>
        <ul class="rounded">
            <li><video id="vid1" src="bunny.mp4" width="90" height="60" onClick="test()" class="draggable"></video>
            <video id="vid2" src="bunny.mp4" width="90" height="60" class="draggable"></video>
            <video id="vid3" src="bunny.mp4" width="90" height="60" class="draggable"></video></li>
            <li><video id="vid4" src="bunny.mp4" width="90" height="60" class="draggable"></video>
            <video id="vid5" src="bunny.mp4" width="90" height="60" class="draggable"></video>
            <video id="vid6" src="bunny.mp4" width="90" height="60" class="draggable"></video></li>
        </ul>
        <ul class="rounded">
            <div id="dropbox1" class="drop"></div>
            <div id="dropbox2" class="drop"></div>
            <div id="dropbox3" class="drop"></div>
            <div id="dropbox4" class="drop"></div>
            <div id="dropbox5" class="drop"></div>
            <div id="dropbox6" class="drop"></div>
        </ul> 
    </div>

The pages are loaded dynamically, so the first loads "about" and the second loads "CreateVids"

The page is being run from a JQuery function

$('#pageevents').
                    bind('pageAnimationStart', function(e, info){ 
                        $(this).find('.info').append('Started animating ' + info.direction + '&hellip; ');
                    }).
                    bind('pageAnimationEnd', function(e, info){
                        $(this).find('.info').append(' finished animating ' + info.direction + '.<br /><br />');

I want to load the script when the "CreateVids" is loaded into the browser. The idea is that I can select the "draggable" class on the video tags and drag them using JQuery.

Any ideas will really be appreciated, Thanks again


You can wrap the required script in a function, and call it inside pageAnimationEnd using an if (or a switch) to check for the correct page (or if the page changer switch is of your own, you can call it right there).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜