Closed Thread Icon

Topic awaiting preservation: Turn Scrollbars On/Off in Existing Pop-up (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8399" title="Pages that link to Topic awaiting preservation: Turn Scrollbars On/Off in Existing Pop-up (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Turn Scrollbars On/Off in Existing Pop-up <span class="small">(Page 1 of 1)</span>\

 
Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 11-19-2002 08:47

I recently realized that the pop-ups on my site (which I use for such things as viewing a larger version of an image, etc.) all opened never use the same window. I assume I did that because, at the time, I couldn't figure out how to resize an existing pop-up to fit the image it contained.

I just now tried opening them all in the same window and I added resizeTo to change the window's size:

code:
function createPopup(url,pwidth,pheight,scrollbars)
{
Popup = window.open(url,"Pop","width=" + pwidth + ",height=" + pheight + ",status," + scrollbars + "resizable");
Popup.resizeTo(pwidth,pheight);
setTimeout('Popup.focus()',500);
}



The resize works, but now problem is this: I bring up some pop-ups with scrollbars (when there's only a single image) and some pop-ups without scrollbars (when there are multiple images to scroll down through). Whichever way it's brought up initially is the way it stays.

So, is there a way to turn on/off the scrollbars in an existing pop-up window?

(And is using sizeTo reliable in the first place?)



Offbeat, roadside Texas attractions. (A little Google bombing doesn't hurt.)

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

posted posted 11-19-2002 12:12

I don't know of a way to turn scrollbars on and off with JavaScript, but what you could try is opening the popups without saying if they should have scrollbars or not and then use the CSS overflow property (set to 'auto' or 'none' in the individual HTML files' BODY tags) to hide them where needed.

Rooster
Bipolar (III) Inmate

From: the uterus
Insane since: Nov 2002

posted posted 11-19-2002 19:25

*errmmmmm... looks blankly in both directions*


Sorry kuckus, I should have read your reply before posting.



[This message has been edited by Rooster (edited 11-19-2002).]

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

posted posted 11-19-2002 19:39

Yep, that's exactly what I've been talking about

Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 11-19-2002 20:38

Most often, the pop-up just contains an image. Don't want to create a separate HTML for every pop-up.

However, I thought I saw around here somewhere a way to build the HTML dynamically using JS. Can't seem to find it, though. Anyone?

Edit: Nevermind... I just discovered Bug's dynamic-resize script, which demonstrates it for me. Think I'll incorporate that into my pop-up, too, so I can stop sending the image size with every link.


  Offbeat, roadside Texas attractions. (A little Google bombing doesn't hurt.)

[This message has been edited by Wes (edited 11-19-2002).]

Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 11-19-2002 20:54

Oh, one more question before I embark on a journey of frustration:

How long of a string can I send to the JS function? What I'd like to do for those images where I do add a caption is to build the HTML dynamically for those, as well. I'd need to send the caption along with the link, like so:

<A HREF="javascript:createPopup('image.jpg','This is the caption for this particular image.<BR>Funny, eh?');">

Is there anything special I would need to take into account when doing so?

Thanks for all the help!


&nbsp;&nbsp;Offbeat, roadside Texas attractions. (A little Google bombing doesn't hurt.)

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

posted posted 11-19-2002 21:01

Rooster: No problem - you really wouldn't have needed to delete what you had posted because of that, it was a nice coding example

Wes: If the single images don't ever need scroll bars and only some of the HTML pages need it, then it shouldn't be much of a problem to do it the other way round. You can set the popup to not display scrollbars by default, and include overflow: auto; in the HTML pages which need it.

Hope that makes some sense

Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 11-19-2002 21:14

Right, but since I'd like everything to pop up in the same window, I'd still need to turn off the scrollbars again when popping up a single image into a window that previously had scrollbars. So, I'd still need to define the overflow to turn them off, which I can do in the dynamically created HTML.

We'll have to see if that works...

Of course, I'm not ever sure I'm making sense to myself now.


&nbsp;&nbsp;Offbeat, roadside Texas attractions. (A little Google bombing doesn't hurt.)

« BackwardsOnwards »

Show Forum Drop Down Menu