html - How to enable links if a parent element uses a fullscreen pseudo-element? -


my page looks this:

<div.ui-page>   <div.ui-content>     <a href="foo.html">   </div> </div> 

on page, i'm setting fullscreen watermark so:

/* watermark */ .ui-page:before {     background: url("../img/foo.png") no-repeat center center;     position: absolute;     content: "";     top: 0;     bottom: 0;     left: 0;     right: 0;     width: 100%;     height: 100%;     /* transparency */     opacity: .2;     /* grayscale */     filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><fecolormatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");     filter: gray;     -webkit-filter: grayscale(100%) brightness(10%) contrast(100%); } 

which works fine. problem is, link no longer clickable.

i tried moving around :before pseudo element along various degrees of z-index. don't work. strangely though seems pertain basic links. links wrapped in other elements work fine (i'm using jquery mobile, links inside ul work)

question:
how can keep plain link clickable/workable if parent element or element contains link uses css pseudo element?

thanks!

solution:
here final code. note, had switch ui-page-active - otherwise works on first page being loaded in jquery mobile.

.ui-page-active:before {     background: url("../img/foo.png") no-repeat center center;     background-attachment: fixed;     content: "";     position: absolute;     top: 0;     bottom: 0;     left: 0;     right: 0;     width: 100%;     height: 100%;     /* transparency */     opacity: .2;     /* grayscale */     filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><fecolormatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");     filter: gray;     -webkit-filter: grayscale(100%) brightness(10%) contrast(100%); } /* disable pointer events on background... */ .ui-page.ui-page-active:before {     pointer-events: none; } 

this solution not 100% cross-browser, can add following code make mouse click-through element:

.ui-page:before {   pointer-events:auto; } 

read lea verou's excellent css secrets guide more info

edit:

if fails, try adding:

.ui-page { pointer-events: none; } .ui-page:before { pointer-events: none; } 

i tested out in own app. hope helps.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -