PHP Developers Network
http://forums.devnetwork.net/

Can :hover e set to :click in CSS?
http://forums.devnetwork.net/viewtopic.php?f=68&t=141631
Page 1 of 1

Author:  simonmlewis [ Fri Aug 07, 2015 10:08 am ]
Post subject:  Can :hover e set to :click in CSS?

Syntax: [ Download ] [ Hide ]
.admin_listproducts ul li:hover ul {
  display: block;
  opacity: 1;
  visibility: visible;
width: 130px;
  z-index: 2;
-webkit-box-shadow: 0px 5px 5px -7px rgba(0,0,0,0.75);
-moz-box-shadow: 0px 10px 5px -7px rgba(0,0,0,0.75);
box-shadow: 0px 7px 5px -5px rgba(0,0,0,0.75);
}


I have this part of a CSS Class. It makes a menu popup when hovering over the DIV. But it wont' work for mobile.

So can it be altered so it works on Click instead? the DIV appears over the top of other stuff.

Author:  Christopher [ Fri Aug 07, 2015 2:43 pm ]
Post subject:  Re: Can :hover e set to :click in CSS?

Using Javscript would be the easiest. Have you tried using :focus or :active in addtion to :hover?

Author:  simonmlewis [ Fri Aug 07, 2015 2:46 pm ]
Post subject:  Re: Can :hover e set to :click in CSS?

Active wont' work as it only makes it popup when the click is 'down'. So rubbish for mobile friendly.
Would focus work then??

Author:  Celauran [ Mon Aug 10, 2015 6:47 am ]
Post subject:  Re: Can :hover e set to :click in CSS?


Author:  simonmlewis [ Mon Aug 10, 2015 6:52 am ]
Post subject:  Re: Can :hover e set to :click in CSS?

Really? So if you want a click on it to make the menu popup... how are you meant to click the links n the menu, if when you "unclick" the mouse, the menu disappears as it's no longer "active"?

Author:  Celauran [ Mon Aug 10, 2015 6:58 am ]
Post subject:  Re: Can :hover e set to :click in CSS?

Yeah, I was thinking JS .click rather than CSS :active. My mistake.

Author:  simonmlewis [ Mon Aug 10, 2015 7:11 am ]
Post subject:  Re: Can :hover e set to :click in CSS?

So I don't know how to do that.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/