473,385 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Div over the pdf iframe

65
hi all,

I have one Iframe which opens a PDF on Click of a button.
I want to display a DIV layer over the IFrame. Before loading the PDF the Div layer is Visible on top of the IFrame.But after pdf loads it disappears.

Any Idea about Displaying Iframe over the IFrame with PDF?

regards
Veena
Mar 22 '10 #1
2 10596
acoder
16,027 Expert Mod 8TB
Can you give an example link or some code?
Mar 25 '10 #2
RamananKalirajan
608 512MB
Hi Veena,
I also had the same problem. But I fixed the problem by placing an empty iframe beneath the div i.e. an iframe is kept behind the div with the same height and width of the div which is shown over the iframe which shows the pdf.

HTML Code:

Expand|Select|Wrap|Line Numbers
  1. <iframe  id  = "docframe" name = "docframe" frameborder="1" style = "background-color:#fffffff;margin-left:8px;" width="99%" height="400px" style="border:none;display:none;"></iframe>
  2.  
  3. <iframe id="theframe" src="" class="frmcls" style="display:none;"></iframe>
  4. <div id="fade" class="black_overlay"> </div>
'docframe' - loads the PDF

'fade' - div which is shown on top of the iframe containing pdf


'theframe' - dummy frame which is kept beneath the div 'fade'

Styles for dummy frame:

Expand|Select|Wrap|Line Numbers
  1. .frmcls
  2.         { 
  3.             position:absolute;
  4.             z-index:998;
  5.             -moz-opacity: 0.2;
  6.             opacity:.20;
  7.             filter: alpha(opacity=20);
  8.         }
  9.         iframe{
  10.             border: none;
  11.         }
JS Code

Expand|Select|Wrap|Line Numbers
  1. function positionIFrame(divid, frmid)
  2.     {
  3.         var div = document.getElementById(divid);
  4.         var frm = document.getElementById(frmid);
  5.         frm.style.left = div.style.left;
  6.         frm.style.top = div.style.top;
  7.         frm.style.height = div.offsetHeight;
  8.         frm.style.width = div.offsetWidth;
  9.         frm.style.display = "block";    
  10.     }
  11.  
  12.  
  13.     //findPosX and findPosY are included only to put the div over the dropdownbox.
  14.     //They are not necessary in order to position the iFrame under the div
  15.     function findPosX(obj)
  16.     {
  17.         var curleft = 0;
  18.         if (obj.offsetParent)
  19.         {
  20.             while (obj.offsetParent)
  21.             {
  22.                 curleft += obj.offsetLeft
  23.                 obj = obj.offsetParent;
  24.             }
  25.         }
  26.         else if (obj.x)
  27.             curleft += obj.x;
  28.         return curleft;
  29.     }
  30.  
  31.     function findPosY(obj)
  32.     {
  33.         var curtop = 0;
  34.         if (obj.offsetParent)
  35.         {
  36.             while (obj.offsetParent)
  37.             {
  38.                 curtop += obj.offsetTop
  39.                 obj = obj.offsetParent;
  40.             }
  41.         }
  42.         else if (obj.y)
  43.             curtop += obj.y;
  44.         return curtop;
  45.     }
  46.  
  47.     function positionDiv(divid, frmid)
  48.     {    
  49.         var div = document.getElementById(divid);
  50.         div.style.left=findPosX(document.getElementById("docframe"))- 8 + "px";
  51.         div.style.top=findPosY(document.getElementById("docframe"))- 25 + "px";
  52.         positionIFrame(divid, frmid);
  53.     }
While showing the div over the iframe just call the function positionDiv('fade', 'theframe');

This will do the rest.

Thanks and Regards
Ramanan Kalirajan
Mar 25 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Csaba2000 | last post by:
I want to be able to embed a single quote into an INPUT element within a dynamically generated IFRAME. The example below shows how the IFRAME is generated. Challenge: I'd like the alert box to...
4
by: Thomas | last post by:
Hi there, I have an iframe which is editable (designMode = "on") and want to resize it dynamically as the content grows (e.g. more lines of text is in there) and there the struggle starts. I...
2
by: Templar | last post by:
Hi i'm bothering with such problem... I must dynamic create an Iframe, and then put som raw HTML into it. But I can't. When I create iframe, I can't access its properties. Here's the coe...
1
by: Martin | last post by:
There seems to be some strange behaviour when trying to get the scrollHeight and scrollTop of an iframe in IE6. I have tried several ways of getting these values when the iframe is written into...
7
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+...
3
by: Angel | last post by:
How do I get the reference of the IFrame from the asp.net webpage that is being displayed within that IFrame? In other words I have an IFrame in my page. Within that IFrame Set the source to a...
0
by: tequilamala | last post by:
I have an Iframe in one of the pages i am developing... the iframe is suppose to scroll up and down and the links target the iframe. the problem is that the iframe scrolls side to side on internet...
1
by: Z1P2 | last post by:
I would like to gradually resize an iframe in an onmouseover event. I can easily do it with an image, but when I try to do it with an iframe, it doesn't do anything. So first of all, is it possible...
1
by: cdmsenthil | last post by:
I have an Infragistics UltrawebGrid . Each Row in the grid is attached to a context menu using Infragistics CSOM Upon click on the menu, I am creating an Iframe dynamically which points to...
23
by: vunet | last post by:
It is recommended by some sources I found to create IFrames in IE using document.createElement('<iframe src="#">') instead of document.createElement('iframe'). Why and what browser versions to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.