handleOversize and manual initialization

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

handleOversize and manual initialization

blockedmind-2
I've got two important questions:
1. I would like to use handleOversize with "none" property but with a real "none". I want to have a scrollbar on  the page (not in box) when image's height is bigger than browser's, but Shadowbox's box is limited to browser height which prevents it.
2. How can I initialize shadowbox when a page is loaded?
Reply | Threaded
Open this post in threaded view
|

Re: handleOversize and manual initialization

Wizzud
1. Hmm ... not easy, because what you actually want to do is changed from fixed positioning to absolute, which means changing the css and changing the core script. You'd need to change all the dimension calculations, plus the IE6 style handling, plus possibly a few other bits I haven't thought of. And it's not just height, but width as well. Using the page's scrollbars means that if your document is scrolled prior to activating Shadowbox, then with Shadowbox activated your scrollable area is going to be at least the same (and possibly greater than) when not activated - which means that the user could scroll the image right out of view.
You might be better of just using a straightforward modal script and displaying the image in it, rather than trying to modify Shadowbox.
(You've stated that you want the scrollbars on the page, not the box. Putting scrollbars on the box is also possible, with a bit of tweaking, and would be more in keeping with the Shadowbox philosophy of displaying content within the current viewport.)

2. I think you might mean 'activate' as opposed to 'initialize'? (If you don't, then I suggest RTFM).
If you want to 'activate' an element into Shadowbox on page load then after the init() call, call Shadowbox.open() passing in the element to open.

eg.

window.onload = function(){ //or relevant DOM Ready function
  Shadowbox.init(); //supply options as needed
  Shadowbox.open(document.getElementById('initialSboxElem'));
};

where your html might contain something like...

< a id='initialSboxElem' href='image.jpg' rel='shadowbox'>image< /a>


Obviously, if you are using a library you can simplify as appropriate.

[There is also an example of a 'welcome message' (on page load) in the Advanced section of the Usage documentation]
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: handleOversize and manual initialization

blockedmind-2
1. i'd achieve if i edit whole code but i wondered if there is a short way... but i think this feature should be implemented as an another handleOversize propery. Lightbox does it. First it resizes the image wrt browser size and shows the full image in the div and page scrollbar is being used, also you can show full size directly. since shadowbox fixes height of its div to browser size to implement drag option, this becomes imposible. I really want to use Shadowbox instead Lightbox. This feautured needs to be implemented as an another option for those who does not want drag, needs full size show.

2. Yes, i meant activation. i'll try it. Thanks.