Results 1 to 6 of 6

Thread: Simple Image Gallery PopUp using Javascript

  1. #1
    Join Date
    Mar 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face Simple Image Gallery PopUp using Javascript

    I have an image gallery of thumbnails in an html page. I want it so that you can click on these thumbnails and it will open up the original bigger picture inside an HTML file in a new window using javascript coding.

    I also need to make it so that each photo opens in a new window using the SAME html page. I think they are called URL variables or something of that sort. for instance if I have a picture with the filename pick001.jpg I want it so that when you click on its thumbnail it opens up in a URL like "photo.html?=pick001.jpg".

    One more requirement is for each of the popups to open in the SAME window. I dont want multiple new windows opening each time the user clicks on a thumbnail.

    Can anybody help me with this?

  2. #2
    Join Date
    Jan 2007
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Which server side scripting language are you using your page. If you can tell me that i would help you. so lease be more descriptive.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Actually, that can be done all on the client side. Your page could even be generated as part of the pop up function. Here is an example:

    http://www.mediajazzbynight.com/2006/gallery.htm

    View the source to see the script code, it is the one with this credit:

    Code:
    Auto center window script- Eric King
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jan 2007
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you jscheuer1. I also learned something from that link that without any file we can get pop up too.

  5. #5
    Join Date
    Mar 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    Actually, that can be done all on the client side. Your page could even be generated as part of the pop up function. Here is an example:

    http://www.mediajazzbynight.com/2006/gallery.htm

    View the source to see the script code, it is the one with this credit:

    Code:
    Auto center window script- Eric King
    can't thank you enough man, this is very useful.

    i'm loading the new window from a flash movie though. Will I be able to do that with this script?

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by eastboy301 View Post
    can't thank you enough man, this is very useful.

    i'm loading the new window from a flash movie though. Will I be able to do that with this script?
    Probably not by using the usual Action Script syntax for loading a new window. However, I believe there is a way to run javascript from Flash. That would be the way to go but, it may be blocked by a pop up blocker.

    If you can put a link into the Action Script and have its href be like:

    Code:
    <a href="javascript:NewWindow('image.jpg','amigos','676','397','no', 'Ellas y Amigos')">whatever</a>
    Thats:

    Code:
    javascript:NewWindow('path_name_if_needed/image_name.jpg','pop_up_name','width','height','scrolling_yes/no', 'pop_up_title')
    Doing it like that might make the pop up blocker think it is 'user initiated'.

    Also, you can still do it as rajug was suggesting with a bit of server side code to get the image from the query string in the link but, you would have less (if any) control over the window size and chrome.

    Additionally, query strings can be processed via javascript but, this requires javascript be enabled and that the server isn't messing with the query string in any way that might confuse the script. The same limitations as using a server side query string would be still be present.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •