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 trialGabriel Ward
20,222 Pointsappending links/buttons
I'm wanting to add button/links to the overlay, not images and captions.
Does anyone have any advice on how to do this?
Here's an idea of what I'm after
http://tympanus.net/Development/FullscreenOverlayStyles/
Any help is much appreciated.
3 Answers
Mark Shaw
10,449 PointsHere's a very simple example of what I think you want. Obviously there is some functionality I didn't include and it needs to be styled. Hope this helps.
Raúl Barrera C.
18,943 PointsYou can include any element to overlay and style with css:
<div class="overlay">
... any html element
</div>
Gabriel Ward
20,222 PointsHi Rau,
So just to clarify, this goes in the jquery?
Gabriel Ward
20,222 PointsOk I think I'm getting it. I just realised that instead of having the buttons in html markup, I can have the image as per usual. Then as you show in your example, the links can be within var $newDiv.
The functionality is just to link to other pages on the website. So the links would be to the About page, Contact, etc.. Basically instead of those being in a normal nav set up on the Homepage, they would appear on the overlay.
If you click on the first overlay example here on this page, labelled Huge, you'll get a feel for it I think. http://tympanus.net/Development/FullscreenOverlayStyles/
Again, really appreciate your help.
Mark Shaw
10,449 PointsAwesome. It's my pleasure to help. Not that I'm any sort of expert cause I'm certainly not!
Gabriel Ward
20,222 PointsGabriel Ward
20,222 PointsHi Mark,
I've tried clicking on the link and it doesn't work. Any alternative way I can see the code?
Cheers,
Gabe
Mark Shaw
10,449 PointsMark Shaw
10,449 PointsI'll just add the code here and you can paste it into your own workspace.
index.html
main.css
script.js
Gabriel Ward
20,222 PointsGabriel Ward
20,222 PointsOk thanks for the code.
What I'm after is to have the image on the page, like in the lightbox example that the video tutorial goes through. And then when you click on that, the overlay appears. Then on the overlay the links/buttons appear. So specifically I'm wanting to work out how to attach the button to the overlay without it appearing in the normal page. Do you have any suggestions for this?
I'm assuming it would go somewhere within
var $newDiv = $('<div class="new"><p><a href="www.google.com">Click here to go to google</a></p></div>');
?
Mark Shaw
10,449 PointsMark Shaw
10,449 PointsSo you want to click the image. When the image is clicked an overlay appears with links and buttons on it. What functionality should the buttons have?