Ah the age old problem of having popup windows on your thumbnails. I figured out a good way to do this with some modifications of the img_assist plugin.
Change line 813:
$img_template = t($img_template, array('%caption' => $vars['caption'], '%node-link' => url("node/$image->nid"), '%img-link' => $image->filepath, '%alt' => check_plain($vars['alt']), '%width' => $width, '%height' => $height, '%src' => $src, '%image-class' => $class));
To
$img_template = t($img_template, array('%caption' => $vars['caption'], '%node-link' => url("node/$image->nid"), '%img-link' => $image->filepath, '%alt' => check_plain($vars['alt']), '%width' => $width, '%height' => $height, '%src' => $src, '%image-class' => $class, '%orig_src' => file_create_url($image->filepath), '%orig_height' => $image->height, '%orig_width' => $image->width));
Now, we just need to add support in the img_assist configuration.
And finally, a JavaScript function to tie it all together:
function openWindow(url, name, w, h, perc, scrollbars) {
// initialize winX and winY to default values
// for cases where Screen object isn't supported
var winX = 0;
var winY = 0;
// only set new values if 4.0 browser
if (parseInt(navigator.appVersion) >= 4) {
winX = (screen.availWidth - w)*perc*.01;
winY = (screen.availHeight - h)*perc*.01;
}
popupWin = window.open(url, name, 'width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY + ',scrollbars=yes, menubar=yes,resiable=yes');
}
And then you've got popups! Hooray!

Post new comment