Reputation: 769
I have four links which open on an iframe on that same page. My problem is that the iframe takes the space on page load and I want that it will remain hide until any link is clicked coz in small screen size the same page is loading on that iframe on page load though it working well in big screen size.
Here is my code for opening the iframe :
<ul class="thumbnails">
<li class="span2">
<h6>DELHI :</h6>
A-21/13,Naraina Industrial Area,
Phase II,
New Delhi - 110028.
Tel. No. : 011 - 49807100 / 101
<a href="https://maps.google.co.in/maps?f=q&source=s_q&hl=en&geocode=&q=Pearl+Academy+of+fashion,+CH+Girdhari+Lal+Marg,+Naraina+Industrial+Area,+Naraina,+Delhi&aq=0&oq=Pearl+Academy+Of+Fashion+de&sll=20.984928,82.752628&sspn=61.071168,79.013672&ie=UTF8&hq=Pearl+Academy+of+fashion,+CH+Girdhari+Lal+Marg,+Naraina+Industrial+Area,+Naraina,+Delhi&t=m&ll=28.648453,77.146039&spn=0.011298,0.037293&z=15&output=embed" target="frame">Click Here To View Map</a>
</li>
<li class="span2">
<h6>NOIDA :</h6>
B-25,Sector - 59,
Noida- 201301, UP.
Tel. No. : 0120 - 4904000
<a href="https://maps.google.com/maps?f=q&source=embed&hl=en&geocode=&q=B-25,Sector+-+59,+Noida-+201301+UP.&sll=37.0625,-95.677068&sspn=50.244827,79.013672&ie=UTF8&hq=&hnear=Sector+59,+NOIDA,+Gautam+Buddha+Nagar,+Uttar+Pradesh,+India&t=m&ll=28.610219,77.367697&spn=0.022605,0.074587&z=14&iwloc=A&output=embed" target="frame">Click Here To View Map</a>
</li>
<li class="span2">
<h6>CHENNAI :</h6>
82,Sterling Road,
Nungambakkam,(Opposite Loyola College),
Chennai - 600034
Tel. No. : 044-42664445 /46/49/50, 43447900
<a href="https://maps.google.co.in/maps?f=q&source=s_q&hl=en&geocode=&q=Pearl+Academy+Of+Fashion,+Sterling+Rd,+Nungambakkam,+Chennai,+Tamil+Nadu&aq=0&oq=Pearl+Academy+Of+Fashion,+Chennai&sll=13.065034,80.239013&sspn=0.008121,0.009645&ie=UTF8&hq=Pearl+Academy+Of+Fashion,&hnear=Sterling+Rd,+Nungambakkam,+Chennai,+Tamil+Nadu&t=m&ll=13.065516,80.239592&spn=0.006271,0.018647&z=16&iwloc=A&output=embed" target="frame">Click Here To View Map</a>
</li>
<li class="span2">
<h6>JAIPUR :</h6>
SP-38A,RIICO Industrial Area,
Delhi Road,Kukas,
Jaipur-302028.
Tel. No. : 01426 - 414800, 227515, 227616, 227617
<a href="https://maps.google.co.in/maps?f=q&source=s_q&hl=en&geocode=&q=Pearl+Academy+Of+Fashion,+Jaipur+city+office,+Rajasthan&aq=&sll=25.845253,74.840307&sspn=7.677536,9.876709&ie=UTF8&hq=Pearl+Academy+Of+Fashion,+Jaipur+city+office,&hnear=Rajasthan&t=m&cid=16689440355655361409&ll=27.527758,76.783447&spn=2.922529,9.547119&z=7&iwloc=A&output=embed" target="frame">Click Here To View Map</a>
</li>
</ul>
<span style="color: #e15b1f;">For more information contact:<a href="#"> [email protected]</a>, Toll Free No. 1800 103 3005</span>
And here is the iframe on same page:
<div style="display:none;">
<iframe name="frame" src="#" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="870" height="300"></iframe>
</div>
Upvotes: 4
Views: 4691
Reputation: 32182
Now you can do this :focus
As like this
Css
.frame_div{
border:solid 1px red;
width:300px;
display:none;
}
.frame_div iframe{
height:200px;
width:300px;
background:green;
}
.click_iframe{
display:inline-block;
vertical-align:top;
}
.click_iframe:focus + div{
display:block;
}
HTML
<ul class="thumbnails">
<li class="span2">
<a href="#" target="frame" class="click_iframe">Click Here To View Map</a>
<div class="frame_div"><iframe name="frame" src="#" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="870" height="300"></iframe></div>
</li>
</ul>
Upvotes: 3
Reputation: 28124
You could add an onclick event to your ul:
<ul class="thumbnails" onClick="document.getElementById('frame').parentNode.style.display=''">
assuming that your iframe id is "frame":
<div style="display:none;"><iframe name="frame" id="frame" src="#" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="870" height="300"></iframe></div>
Upvotes: 3