Zen Cart Logo
Forums / General Questions / larger image not resizing to picture size

larger image not resizing to picture size

Views: 1,897

Results 1 to 5 of 5
17 Feb 2013, 5:14 PM
#1
gilbertholdings avatar

gilbertholdings

New Zenner

Join Date:
Jan 2013
Posts:
3
Plugin Contributions:
0

larger image not resizing to picture size

ZC version: 1.5.1
page url: http://www.negativeionaccessories.com/index.php?main_page=product_info&cPath=6&products_id=26

I'm having a problem when clicking the "larger image" link in the product info pages. My large images are 600x600, but the pop up window is smaller.

I've tried editing the jscript_main.php popupWindow function in the includes / modules / pages / product_info directory, but it doesn't seem to change anything. The weird thing is the window will first pop up one size, seeming set by the popupWindow function, then load the image and resize to a new size that doesn't appear to be correlated to the popupWindow function.

In my site, the original window looks like it comes up at 100x100, correlated to the width/height variables in the popupWindow function. then it loads the image and resizes to something larger, maybe 600x400. I've tried changing all the variables. If I change variables, they seem to change the initial popup window dimensions before the image is loaded, but then the image is loaded and the window resizes to the 600x400 size.

I've also tried additionally changing the popupWindowPrice function, but i couldn't see any changes happening based on changing this function. It appears as though the width/height variables are the ones that need to change, but they aren't having any effect on the final window size.

I've included the two functions below for reference. Any help would be greatly appreciated.

function popupWindow(url) {
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

function popupWindowPrice(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=400,screenX=150,screenY=150,top=150,left=150')
}

Thanks for any help,

Adam

18 Feb 2013, 2:23 PM
#2
terragirl avatar

terragirl

Zen Follower

Join Date:
Jun 2010
Location:
Austria
Posts:
123
Plugin Contributions:
0

Re: larger image not resizing to picture size

the pop-up first appearing as 100x100 is normal, Zen Cart first loads the new window in that size, then resizes.

the image is actually 600x600 but the surrounding BODY is 1000px, pushing the image to the right (tested in Firefox). The 1000px setting comes from http://www.negativeionaccessories.com/includes/templates/custom/css/stylesheet.css , line 11

body {
    background-color: #3E4147;
    font-family: verdana,arial,helvetica,sans-serif;
    font-size: 62.5%;
    margin: 0 auto;
    width: 1000px;
}

The body style applies to ALL windows including pop-ups. So either remove the command from the CSS, or give the pop-up a different body class (or ID) and then over-ride the default body style via CSS.

18 Feb 2013, 4:42 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: larger image not resizing to picture size

terraGirl:

So either remove the command from the CSS, or give the pop-up a different body class (or ID) and then over-ride the default body style via CSS.
Correct.
Since the pop-up has its own body ID of "popupImage" you can override the default body style by adding this to your CSS (stylesheet.css):

body#popupImage {
  width: auto;
}
18 Feb 2013, 8:25 PM
#4
gilbertholdings avatar

gilbertholdings

New Zenner

Join Date:
Jan 2013
Posts:
3
Plugin Contributions:
0

Re: larger image not resizing to picture size

Thanks!

I added the CSS line and it worked perfectly. I would have never thought about checking that. I guess i had the javascript stuck in my mind from reading a related post.

18 Feb 2013, 8:37 PM
#5
terragirl avatar

terragirl

Zen Follower

Join Date:
Jun 2010
Location:
Austria
Posts:
123
Plugin Contributions:
0

Re: larger image not resizing to picture size

Fab, glad it's working!

PS: I use FireBug to check out CSS styling - if you're used to FireFox, it's a really good add-on.