Reply
Problem with show/hide a table within a resizable iframe.
Old 12-13-2007, 03:09 PM Problem with show/hide a table within a resizable iframe.
Junior Talker

Posts: 3
Name: Fred Lefranc
Location: Paris, FR
Hi,

here's the situation :

a html page, with an iframe which resize itself to display the whole called file without scrolling bar.
one of the iframe's html file got hidden <div>.
clicking the menu will toggle show/hide these hidden <div>.

here's the trouble :
the iframe get its height with <div> hidden on the loading,
when i click to show the <div> part, the iframe keeps its base height and scrooling bars appears.

is there any way to resize the iframe when i show/hide the <div> ?
Friedd is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 12-13-2007, 08:57 PM Re: Problem with show/hide a table within a resizable iframe.
vangogh's Avatar
Post Impressionist

Posts: 8,831
Name: Steven Bradley
Location: Boulder, Colorado
Code or a link to the page in question would help.

You might need to resize the iframe with javascript at the same time the div gets clicked. Are you using javascript to show/hide the div? If so you should be able to add code in the same function that handles the show/hide to change the size of the iframe.

Hard to say for certain without seeing some code.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 12-15-2007, 07:21 PM Re: Problem with show/hide a table within a resizable iframe.
Junior Talker

Posts: 3
Name: Fred Lefranc
Location: Paris, FR
Quote:
Code or a link to the page in question would help.
Yes sure !
http://friedd.free.fr/leperiscope/
click on "kaolin" on the left menu.

Quote:
Are you using javascript to show/hide the div?
yes i do,
Code:
<script type="text/javascript">
function toggle(id) {
    document.getElementById(id).style.display = (document.getElementById(id).style.display == "block")?"none":"block";
}
</script>
and
Code:
onMouseDown="javascript:toggle('element1')"
on the words that show/hide the <div>

Quote:
you should be able to add code in the same function that handles the show/hide to change the size of the iframe
as i don't really know javascript, i would love you to tell me what should i add to the code to do that !!
Friedd is offline
Reply With Quote
View Public Profile
 
Old 12-16-2007, 12:09 AM Re: Problem with show/hide a table within a resizable iframe.
vangogh's Avatar
Post Impressionist

Posts: 8,831
Name: Steven Bradley
Location: Boulder, Colorado
I did this really quick, but try:

HTML Code:
<script type="text/javascript">
function toggle(id) {
    document.getElementById(id).style.display = (document.getElementById(id).style.display == "block")?"none":"block";
    
    if (document.getElementById(id).style.display == "block") {
        document.getElementById("main").height +=20px;
    else
        document.getElementById("main").height -=20px;
}
}
</script>
The 20px is a guess. I think that will add 20px (or whatever is necessary) when the div is shown and will subtract that 20px when the div gets hidden again.

I'm not 100% sure this will work, but give it a try.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 12-16-2007, 04:29 AM Re: Problem with show/hide a table within a resizable iframe.
chrishirst's Avatar
Super Moderator

Posts: 13,644
Location: Blackpool. UK
The height calculation ( +=20px; )

should be (+=20) + "px";
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-16-2007, 06:12 AM Re: Problem with show/hide a table within a resizable iframe.
Junior Talker

Posts: 3
Name: Fred Lefranc
Location: Paris, FR
thanks guys, this can be a temporary solution, but i'll soon add a database in one of the <div> to show upcoming events.
so i'm looking for something that'll dynamically resize the iframe with the good amount of px.

anything else ?
Friedd is offline
Reply With Quote
View Public Profile
 
Old 12-17-2007, 09:58 PM Re: Problem with show/hide a table within a resizable iframe.
vangogh's Avatar
Post Impressionist

Posts: 8,831
Name: Steven Bradley
Location: Boulder, Colorado
Oops Chris. See what I get for typing too fast.

Fred if you want a better solution I'd suggest something other than using an iframe. If you're pulling info from a database there's no reason first load it onto a different file and then pull that file into an iframe.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum

Last edited by vangogh : 12-17-2007 at 10:00 PM.
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to Problem with show/hide a table within a resizable iframe.
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.16536 seconds with 12 queries