Floating iFrame

Author: Dynamic Drive

Description: IFRAMEs are loved for their versatility in displaying any external content on the page painlessly. Well, this cool script creates a floating iframe, so it stays static and always in view even when the page is scrolled. Display content from a separate page prominently using it, whether it's a menu, important news, or an image. Furthermore, we did all the Math for you in easily displaying the iFRAME at any one of the four corners of the page. Note that this script is only visible in IE5+ and Opera 7+. A bug in NS6+ causing iframes to not follow the page disables the script from appearing in it.


Demo: To your left IE5+/Opera 7+ users!


Simply insert the below code in the <BODY> section of your page, and change the variables inside script as explained by the comments:

Select All

Now, you may wish to create a link somewhere inside the iframe that dismisses the iframe when clicked on (as illustrated in the demo). Use a code like the following for this:

function closeiframe(){

<a href="javascript:closeiframe()">Close iframe</a>

If you wish to display this link outside of the iframe, remove parent. from within the function above.


Wordpress Users: Step by Step instructions to add ANY Dynamic Drive script to an entire Wordpress theme or individual Post