Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function AjaxLoaded() {
- $('document').trigger('ready');
- }
- <script>
- // easy copy of an array
- Array.prototype.copy = function() {
- return [].concat(this);
- };
- // this function is added to jQuery, it allows access to the readylist
- // it works for jQuery 1.3.2, it might break on future versions
- $.getReadyList = function() {
- if(this.readyList != null)
- this.myreadylist = this.readyList.copy();
- return this.myreadylist;
- };
- $(document).ready(function() {
- alert("blah");
- });
- </script>
- <script>
- // this should be added last so it gets all the ready event
- $(document).ready(function() {
- readylist = $.getReadyList();
- });
- </script>
- <input type="button" onclick="$(readylist).each(function(){this();});" value="trigger ready" />
- function AjaxLoaded() {
- $(document).trigger('ready');
- }
- // Overrides jQuery-ready and makes it triggerable with $.triggerReady
- // This script needs to be included before other scripts using the jQuery-ready.
- // Tested with jQuery 1.7
- (function(){
- var readyList = [];
- // Store a reference to the original ready method.
- var originalReadyMethod = jQuery.fn.ready;
- // Override jQuery.fn.ready
- jQuery.fn.ready = function(){
- if(arguments.length && arguments.length > 0 && typeof arguments[0] === 'function') {
- readyList.push(arguments[0]);
- }
- // Execute the original method.
- originalReadyMethod.apply( this, arguments );
- };
- // Used to trigger all ready events
- $.triggerReady = function() {
- $(readyList).each(function(){this();});
- };
- })();
- // jquery_trigger_ready.js
- // this function is added to jQuery, it allows access to the readylist
- // it works for jQuery 1.3.2, it might break on future versions
- $.getReadyList = function() {
- if(this.readyList != null) { this.myreadylist = [].concat(this.readyList); }
- return this.myreadylist;
- };
- $(document).ready(function() {
- readylist = $.getReadyList();
- });
- $.triggerReady = function() {
- $(readylist).each(function(){this();});
- }
- <html>
- <head>
- <title>trigger ready event</title>
- <script src="test2_files/jquery-1.js" type="text/javascript"></script>
- <script src="jquery_trigger_ready.js" type="text/javascript"></script>
- </head>
- <body>
- <input onclick="$.triggerReady();" value="trigger ready" type="button">
- <script type="text/javascript">
- $(document).ready(function(){
- alert("blah");
- });
- </script>
- </body>
- </html>
- $(document).ready(function () {
- $('.specialClass').click(....
- $(document).bind('ready', function(event) {
- $('.specialClass', event.target).click(..
- loadedDiv.trigger('ready')
- jQuery.fn.loadExtended = function(url,completeCallback){
- return this.load(url,function(responseText, textStatus, XMLHttpRequest) {
- if (completeCallback !== undefined && completeCallback !== null) {
- completeCallback(responseText, textStatus, XMLHttpRequest);
- }
- $(this).trigger("ready");
- });
- };
- $(".container").load(url,function(responseText, textStatus, XMLHttpRequest) {
- $(this).trigger("ready");
- });
- $(".container").loadExtended("tag_cloud.html");
- $(".container").loadExtended("tag_cloud.html",function(){
- alert('callback function')
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement