Set mediaquery with jquery

45 views Asked by At

I wanted to know if this script is OK or not, it should work? I could also use removeClass

    $(window).resize(function() {
  if ($(window).width() <= 890) {   
    $(".vc_custom_1481753917956").css("border", "0px");
   });

};

can work? can it work? I do not need in CSS but in jquery

css new img

1

There are 1 answers

3
Rory McCrossan On

It will work once you remove the typo regarding the extra braces, however it's always better practice to put responsive styling logic in to a stylesheet where possible:

@media (max-width: 890px) { 
  .vc_custom_1481753917956 {
    border: 0;
  }
}