How to call JavaScript on change of CSS

Tags: javascript,css,tinyscrollbar

Problem :

I'm using tinyscrollbar to show some text in a box. I have 2 stylesheets:

<link rel="stylesheet" media="all and (min-width: 1152px) and (max-width: 9000px)" href="grid-1218.css"/>
<link rel="stylesheet" media="all and (min-width: 1px) and (max-width: 1151px)" href="grid-978.css"/>

I face a problem: when I change CSS the box gets bigger but the height stays the same and I don't want to declare height in CSS as i got some more boxes.

Is there any way to rerun the script to get new height?

Solution :

There isn't a specific event for media query changes, as far as I know.

You can bind to the window's resize event and re-run your javascript on every resize, or do some checking to see whether a resize is an important one.

    CSS Howto..

    how to use
    for navigation purpose

    How to dynamically insert css vendor prefixes using jquery

    How do I make footer take 100% of the width of the webpage?

    How to prevent blur from CSS transform?

    How to add text using css in textarea? [closed]

    h1:hover is responding on the whole width, unable to link h1 and don't know how to target things individually

    How to position a fixed div under another fixed div?

    How to style parent li elements of headers using CSS?

    How to get the browser border to lock to a div when resizing?

    How to set dynamic value in css? [closed]

    How to Fade In Background on Page Load - jQuery

    how to bring two blocks closer

    How to change the arrow color of ' select' in a form with CSS [duplicate]

    How to get an automatic effect of rosace in css ?

    How to incorporate CSS into a table

    How to make vim alphabetically sort CSS rules within a single line?

    How to set a menu as selected while selecting its subchild

    How to do auto slide for divs [closed]

    How to prevent menu from closing when losing mouse focus?

    How to fix IE support for line break using CSS pseudo-element?

    How to enable CSS editor features in VS 2012?

    How to get css3 ribbon on both sides of element

    How to place two canvases adjacent to each other and on top of a third one

    How to make a disabled select box look like a normal text box(css only)

    How do I go about targeting the literal “first-child” of a div, styling depending on element type

    How can I make all images of different height and width the same via CSS?

    How can I have a 2 column layout with one of the columns with a fixed width and the other with the remaining width?

    JQuery: how to make this variable negative before declaring it as a CSS value?

    How to write this CSS-Selector (Target img from previous Anchor-Tag)

    how to overrule prior css