Fab
Fab

Reputation: 155

Opening a div with content after clicking a button

I´m building a website in which i want the content to pop up in a div after clicking a menu button instead of going to another html page.

I have the menu built with a unordered list but i cant seem to solve this using the visibility css property.

Is there a way to do this?

I´m not in a hurry, just training my programming skills so this website is just for playing around a little bit.

Thanks for your help.

Upvotes: 1

Views: 178

Answers (1)

meeming
meeming

Reputation: 88

It's called lightbox.
You need adding the click event Listener to a button,and hide the popped up Div at first,then show it when button clicked.
The popped up Div must align center of the screen,so you must add the event Listener of window Resize. Maybe a modal also is needed.
If you write this by hand,browser compatibility is also tedious.
Use plug-ins is convenient.
There are so many good plug-ins that can be used easily.
I recommend jQuery fancybox

Upvotes: 1

Related Questions