Want page 2 of my form to resize SB window?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Want page 2 of my form to resize SB window?

eTard
I am using SB 2.0

I have a form on a site that is 2 pages. I have the first page of the form open by SB like this when you click a link

a rel="shadowbox;width=420;height=680" href="../includes/formpg1.php" title="Form Page 1"

when that Page 1 of the form is submitted, it goes to a much shorter in length Page 2..


SO.. is there a chunk of code I can put into Page 2 that will resize the open SB to match it's smaller/different size and not stay so large?
Reply | Threaded
Open this post in threaded view
|

Re: Want page 2 of my form to resize SB window?

eTard
I tried to add this to the shadowbox.js

Shadowbox.dynamicResize = function(w, h){ 
      if(content){ 
        content.width = w; 
        content.height = h; 
        resizeContent(function(){;}); //needs callback function to animate 
      } 
    }; 

then added this script to Page 2

<script type="text/javascript">
document.observe("dom:loaded", function(){ 
   window.parent.Shadowbox.dynamicResize(500,200); 
}); 
</script>

and it did not resize :(
Reply | Threaded
Open this post in threaded view
|

Re: Want page 2 of my form to resize SB window?

eTard
bump
Reply | Threaded
Open this post in threaded view
|

Re: Want page 2 of my form to resize SB window?

Wizzud
from search ... http://n2.nabble.com/SB3b-and-resizing-iframe-tp3078927p3144488.html ?
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: Want page 2 of my form to resize SB window?

eTard
yep, I have read that and posted in it.. but it does not seem to work as expected as I said in that other post, since you set the height/width of the SB when the page opens with this code

<script type="text/javascript"> window.parent.Shadowbox.skin.dynamicResize(900,100); </script>   
and that is not actually dynamically resizing based on content amount, it is resizing based on the pixel dimensions you give it.

now, this really becomes an issue, for example, if you have 2 different browsers that slightly have variations on how they display the page. One my display 100 pixels of content where the next, like FF, may need 120 pixels to show it. So, with this "trick" since you set it to 100 it works for one and not the other. for it to be truly "dynamic" it should, depending on the content and the browser of course, grow to exactly hat it needs to show your content with no scrollbars.


Reply | Threaded
Open this post in threaded view
|

Re: Want page 2 of my form to resize SB window?

Wizzud
There is no way for Shadowbox to do the type of iframe resizing you seem to want. It cannot determine the dimensions of another page. The only thing it can do is wait to be told what size to try to reset the iframe to.

PS: You seem to be a bit hung up on the use of the word dynamic in the name of the function being called? If it bothers you that much, just call it fred() ... it really doesn't matter. I don't think anyone has ever claimed that that function does "dynamically resize based on content amount" ... anyway, the name you choose to give it is entirely up to you.
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: Want page 2 of my form to resize SB window?

eTard
thanks... there is a partial semantics breakdown issue here...

I do not care what the function is called: "dynamic", "fred", "growme" - that is not my point and i was not at all hung up on the term relative to what I was seeking.

what I was hung up on was the understanding of what "dynamic" implied here. So, it does not imply truly "dynamic" on the fly true growth to the content. It implies that it can surely change size, dynamically, from 1 page to the next, IF you tell each page what size to be.

So you see, in the end, it was a definition of terms and understanding, for SB, what "dynamic" means. The word use in the function means nothing and can be anything.

I now know that in terms of SB "dynamic" means that if you have SB open content in the open SB that it can resize to the content IF you tell SB exactly what dimensions to resize to. It cannot automatically deduce this and thus, grow or shrink "dynamically" as I thought it could and like it does for images. You must  tell it some size parameters to grow/shrink to. So, I thought "dynamic" here meant it could figure out content size and adjust size accordingly. I was wrong, it cannot, it must be told what size to resize to.

so no worries, now I am clear on what it can do and what I have seen in the past for looking like it was "dynamically" adjusting to on others sites was in fact, the loading page telling it to change sizes to a specific set of dimensions passed to it on page load.