jquery - Chrome Extension - Edit Default HTML -


i'm using jquery in google chrome extension overwrite website's default css.

the default class .cataloghovercontent display: none;, when class .smallcatalogitemview or .catalogiteminner hovered, changes display: block;

i've attempted prevent overwriting style using code below, website's default style seems overwriting , class cataloghovercontent still isn't shown default.

.cataloghovercontent {  display: block; } 

is there alternative way edit style, such javascript?

the trigger css. there :hover rules attached 2 <div>s in screenshot below: smallcatalogitemview:hover , .catalogiteminner:hover:

.smallcatalogitemview:hover .catalogiteminner.biginner {     padding-bottom: 12px;     padding-top: 10px; }  .smallcatalogitemview:hover .catalogiteminner.biginner {     top: -10px; }  .smallcatalogitemview:hover .catalogiteminner {     border: 1px solid #ccc;     height: auto;     left: -10px;     top: -20px;     width: 130px;     z-index: 6;     padding-top: 10px;     padding-bottom: 10px;     margin-top: 10px; }  .catalogiteminner:hover {     position: absolute; }  .catalogiteminner, .catalogiteminner:hover {     background: #fff;     border: 0;     outline: 0;     overflow: visible;     position: absolute;     margin: 0;     padding: 0; } 

screenshot

to stop css running, there few options:

  • use javascript set style property of each element:

    var elements = document.queryselectorall(".catalogiteminner"); (var = 0; < elements.length; i++) {     var el = elements[i];     el.style.border = "none";     // ...     // set rest of rules } 
  • use javascript edit stylesheet (document.stylesheets[i].cssrules[j].style.removeproperty() mdn). take fine-tuning, though. have correct indices. how change/remove css classes definitions @ runtime?

  • remove catalogiteminner class. may have unintended side effects.

    element.classlist.remove("catalogiteminner"); 
  • take @ this , overwrite of rules:

    // like: addcssrule(sheet, ".catalogiteminner", "border: none"); // etc. 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -