include ::before pseudo class in javascript

Posted by user1955837 on Stack Overflow See other posts from Stack Overflow or by user1955837
Published on 2014-08-24T22:17:27Z Indexed on 2014/08/24 22:19 UTC
Read the original article Hit count: 136

Filed under:
|

Why is this thing not working? If I remove ::before from javascript and css it works. But due to the design needs there has to be a ::before. How do I point to the class + ::before?

$(function () {



var sections = $("section");
var navigation_links = $("nav a");

sections.waypoint({
    handler: function (event, direction) {

        var active_section;
        active_section = $(this);
        if (direction === "up") active_section = active_section.prev();

        var active_link = $('nav a[href="#' + active_section.attr("id") + '"]');
        navigation_links.removeClass("selected::before");
        active_link.addClass("selected::before");

    },
    offset: '25%'
})

});

css:

.selected::before {
display: block;
content: "";
margin-top: 6px;
width: 8px;
height: 8px;
background: url(../img/sprite.png) -126px -196px;
background-size: 400px 480px;
float: left;
margin-left: 20px;
margin-right: 20px;

}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about css