Ad Code

Responsive Advertisement

Dynamic style - manipulating CSS with JavaScript

                    //remove style sheet
                    var sheetToBeRemoved = document.getElementById(styleID);
                    if (sheetToBeRemoved) {
                        var sheetParent = sheetToBeRemoved.parentNode;
                        sheetParent.removeChild(sheetToBeRemoved);
                    }
 
                    //add style sheet
                    var sheet = document.createElement('style');
                    sheet.type = 'text/css';
                    sheet.id = styleID;
                    sheet.innerHTML = css;
                    document.getElementsByTagName('head')[0].appendChild(sheet)
                    //document.body.appendChild(sheet);
 
                    //apply
                    element.addClass(modalClass);

Post a Comment

0 Comments

Close Menu