freshwebservices
Posts: 5
Joined: Thu Mar 17, 2011 12:07 pm
Location: Leicestershire, UK
Contact: Website

[SOLVED]Setting popup width/height dynamically

Hi Guys,
1st, thanks for such great software!

2) I have 2 issues.

a) I'm using youtube popup but can't get the close to appear on the top right corner

b) I have an ajax popup on the product list page. The idea is that when the user clicks the image, a popup appears with the large product image. My problem is this:
on the product list page I don't have access to the size of the large image. I only get these params when the popup is generated. However, I can't seem to set these dimensions on the popup itself.

Within my popup I've tried the following:

Code: Select all

<script type="text/javascript">
        hs.width='<?php echo ($_imgW);?>';
        hs.height='<?php echo($_imgH); ?>';
        hs.marginBottom = 30;
</script>
& I've also tried to set the container ul like so:

Code: Select all

<ul style="list-style:none;min-width:<?php echo ($_imgW);?>px; min-height:<?php echo($_imgH); ?>px;">
    <li><div class="closeX" onclick="return hs.close(this)" title="Close"></div></li>
    <li>
.......
You can see a live example at the following [removed]

Any suggestions would be most welcome.

Thanks,
Eddie
Last edited by freshwebservices on Sat Mar 19, 2011 9:43 am, edited 2 times in total.
www.freshwebservices.com
freshwebservices
Posts: 5
Joined: Thu Mar 17, 2011 12:07 pm
Location: Leicestershire, UK
Contact: Website

Re: Setting popup width/height dynamically

Hi,
I've now resolved my 1st problem - not being able to add the close button to the utube popup.

Adding the following to the head of the page did the trick

Code: Select all

   hs.registerOverlay({
   html: '<div class="closeX" onclick="return hs.close(this)" title="Close"></div>',
   position: 'top right',
   useOnHtml: true,
   fade: 2 
});
However, I'm still stuck on the 2nd issue - dynamically setting the size of the ajax popup.
Thanks,
Eddie
www.freshwebservices.com
User avatar
RoadRash
Posts: 8249
Joined: Tue Jul 15, 2008 6:43 pm
Location: Fredrikstad, Norway
Contact: Website

Re: Setting popup width/height dynamically

Hi Eddie,

The height of the HTML popup will adjust automatically, and the width of the popup needs to be added to the onclick (or in your case; the var).
I think you will be better off using the Highslide image popup (hs.expand) instead of placing the image in a HTML popup. The image popup will automatically fit to the size of the image. The image title, price and ÔÇ£add to basketÔÇØ can be placed in the caption area.
Hilde
Highslide Support Team

Overview of my Highslide sample pages: RoadRash.no
freshwebservices
Posts: 5
Joined: Thu Mar 17, 2011 12:07 pm
Location: Leicestershire, UK
Contact: Website

Re: Setting popup width/height dynamically

Hi Hilde,
Thanks for your reply.
Will I be able to add html within the image popup? I need price, etc. Also I don't have access to the ing width so can't add it to the link.
Thanks
Eddie
www.freshwebservices.com
freshwebservices
Posts: 5
Joined: Thu Mar 17, 2011 12:07 pm
Location: Leicestershire, UK
Contact: Website

Re: Setting popup width/height dynamically

Hilde,
Just got the meaning of the caption. I'll give that a go.
Thanks
www.freshwebservices.com
freshwebservices
Posts: 5
Joined: Thu Mar 17, 2011 12:07 pm
Location: Leicestershire, UK
Contact: Website

Re: Setting popup width/height dynamically

Hi,
I've now resolved my problem - thanks to Hilde for the help. I've written a little how-to explaining how I did it here http://bit.ly/i0JvXx.

Thanks again,

Eddie
www.freshwebservices.com
User avatar
RoadRash
Posts: 8249
Joined: Tue Jul 15, 2008 6:43 pm
Location: Fredrikstad, Norway
Contact: Website

Re: [SOLVED]Setting popup width/height dynamically

Thanks for sharing, Eddie!
Hilde
Highslide Support Team

Overview of my Highslide sample pages: RoadRash.no

Return to “Highslide JS Usage”