Click here to Skip to main content
15,896,606 members
Articles / Web Development / ASP.NET

Hosting IFRAMEs using the JQuery UI Tabs plug-in - Part 1

Rate me:
Please Sign up or sign in to vote.
4.89/5 (20 votes)
23 Dec 2009CPOL9 min read 95.5K   1.9K   73  
Using JQuery UI Tabs to host web pages via IFRAMEs.
/**
 * jQuery hijack plugin
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * @author Krzysztof Kotowicz <kkotowicz at gmail dot com>
 * @see http://code.google.com/p/jquery-hijack/
 */
jQuery.fn.hijack=function(afterLoadFunction){var target=this;return this.find('a:not(.nohijack)').click(function(event){if(event.isDefaultPrevented())
return;jQuery(target).load(this.href,function(){jQuery(this).hijack(afterLoadFunction);if(jQuery.isFunction(afterLoadFunction)){afterLoadFunction.call(this);}});return false;}).end().find('form:not(.nohijack)').hijackForm(target,afterLoadFunction).end();};jQuery.fn.hijackForm=function(target,afterLoadFunction){if(!jQuery.fn.ajaxForm){return this;}
return jQuery(this).ajaxForm({target:target,beforeSubmit:function(fdata,jqForm,options){if(jqForm.data('skip')){jqForm.data('skip',false);return false;}},success:function(){jQuery(target).hijack(afterLoadFunction);if(jQuery.isFunction(afterLoadFunction)){afterLoadFunction.call(target);}}});};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer Intel Corporation
United States United States
I am an Automation Engineer specializing in application and web development/support.

Comments and Discussions