Articles, tips and tricks, news and other little things to do better our job!

martedì, ottobre 13, 2009

jQuery IFrame Plugin

Although I hate using IFrame, sometimes it's impossible to avoid them.

The impressive use of Javascript and the relative decrement of people using IE had forced designers and programmers to be browser independent more than in the past.
Personally I like jQuery but the $(document).ready() function works only in specific page when you called it.

The IFrame Plugin gets over this limit and with the $.frameReady() function allow us to wait all the IFrame in the page and specify CSS, Javascript, Json formatted data etc we need to pass it!

From the plugin site:


  1. $.frameReady(function(){


  2.   $("I am a div element").prependTo("body");


  3. }, "top.mainFrame",


  4. { load: [


  5.         {type:"script", id:"_fr", src:"/js/myscript.js", test:"myFunction"},


  6.         {type:"stylesheet", id:"_ss", src:"mycss.css"}


  7.         ] }


  8. );
An example to execute the function in the top.mainFrame context automatically including jQuery. This script also loads a javascript file and a css file.

0 commenti:

Cerca nel blog

Caricamento in corso...

About This Blog

Mauro Bennici è Software Architect specializzato in .NET.

Back to TOP