barkera Posted January 21, 2006 Share Posted January 21, 2006 Hi,Only a lot of sites you see some thumbnails and when you click on them it opens a new window with a larger version of the picture in the new window. How do you do that? I don't mean just create a new page and open it up, but just a small window that is the same size as the [picture. Is there anyway to do it like that or will I have to create a new page for each picture?Thanks. Link to comment Share on other sites More sharing options...
Eric Posted January 21, 2006 Share Posted January 21, 2006 So you want a JavaScript pop-up window the same size as the picture?Not just something like *click* (when clicked on open picture in a new window)Ok, I'll post a code for you, but give me a few minutes I gotta go do something.I'll be back here shortly with the code Link to comment Share on other sites More sharing options...
barkera Posted January 21, 2006 Author Share Posted January 21, 2006 yes, thankyou very much. Link to comment Share on other sites More sharing options...
Eric Posted January 21, 2006 Share Posted January 21, 2006 <html><head><script type='text/javascript'>function image1(){window.open('bigimage.gif','Image','width=300,height=120,resizable=no,scrollbars=no,');}</script></head><body><a href='javascript:image1();'><img src='imagethumbnail.gif' alt='' /></a></body></html> Make sure to add a new line of JS code for each imageexample:function image1(){window.open('bigimage1.gif','Image','width=300,height=120,resizable=no,scrollbars=no,');}function image2(){window.open('bigimage2.gif','Image','width=500,height=300,resizable=no,scrollbars=no,');}function image3(){window.open('bigimage3.gif','Image','width=150,height=200,resizable=no,scrollbars=no,');}Set the height and width for each image and call them like this:<a href='java script:image1();'>Edit: I forgot the SCRIPT tags before, added now Link to comment Share on other sites More sharing options...
barkera Posted January 22, 2006 Author Share Posted January 22, 2006 Ah, i'm probably just ignorant, but that didn't work it just says error on page and when I click nothing happens. Also, I presume I need to put a Javascript tag in so it knows its a script? Link to comment Share on other sites More sharing options...
Eric Posted January 22, 2006 Share Posted January 22, 2006 Oh crap, sorry about that<script type='text/javascript'>function image1(){window.open('bigimage1.gif','Image','width=300,height=120,resizable=no,scrollbars=no,');}</script>I forgot to type up the SCRIPT tags Link to comment Share on other sites More sharing options...
barkera Posted January 22, 2006 Author Share Posted January 22, 2006 Nevermind, I fixed it I just added in the script tages. Thanks for the help! :)EDIT: Yea, thats what I put in, thanks, works great now! Link to comment Share on other sites More sharing options...
Eric Posted January 22, 2006 Share Posted January 22, 2006 I'm glad you got it to work Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now