1

I have a jsfiddle here - http://jsfiddle.net/nvz7q39b/

Is it possible to use :after to create an area that is clickable.

Can I add a class to the area created with :after and then use jQuery / Javascript to add an event to it.

        .block{
            background: #ddd;
            height: 50px;
            position: relative;
        }

        .block:after{
            background: red;
            content: "";
            display: block;
            width: 50%;
            height: 50px;  
            z-index: 100;
        }
ttmt
  • 5,822
  • 27
  • 106
  • 158
  • well, technically, you can't since pseudo-elements are not part of the DOM, thus you can't manipulate them with JS (or JQuery or whatever). However, depending on what event you want to add, you can simply manipulate the class to which the pseudo:element belongs, but I imagine this approach is not suitable for every scenario, it will always depends on what do you want to do – Devin Sep 06 '14 at 18:38

0 Answers0