Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

How do you code a pop up window for my portfolio website?

I'm a beginner and I've just finished the "How to make a website" track which is making your portfolio page. The images were made into a link but it doesn't do anything when you click on them. I want to make them pop up to bigger window when viewers click on them so that they can observe them better. How can you do that? Nick didn't explain about that or at least I don't remember him doing so. Where do you write the code? HTML or CSS? Can someone provide a sample? Any answers are much appreciated~!

2 Answers

Alix, that is not included in that "How To Make a Website" course because it is a more advanced featured. There are two ways I can think of if you want to do something like that:

1) The jQuery Basics course has a small project in it called "Creating a Simple Lightbox." You create a small image gallery that allows users to click on each thumbnail and get a bigger pop-up window of the image. It really is best, though, to go over JavaScript first before moving on to something like this. Here is the link to the first video for that project:

https://teamtreehouse.com/library/jquery-basics/creating-a-simple-lightbox/preparation

2) Better for beginners who only know HTML and CSS is using Bootstrap modals. I haven't gone through Bootstrap on Treehouse, but I have used Bootstrap modals that pop up with an image and information underneath it. There is a Bootstrap 4 Basics course, and within that course is a video about displaying a modal window. Here it is:

https://teamtreehouse.com/library/bootstrap-4-basics/using-bootstrap-components/displaying-a-modal-window

Thank you Danielle~! I think I will try your first suggestion~!