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 make CSS width to fill parent?

    How to “break line” via CSS?

    How do I create a bar chart in CSS with an array of PHP float values?

    How to set height to wrap text only in certain screen size

    How to change comma separated css values with Jquery.css Method?

    How to define a Click handler function for multiple elements at the same time

    How to uniformly darken colors?

    How do I add an image to a progress bar in HTML/CSS?

    How to margin div inside other div?

    How to select ids which contain special characters?

    How to scroll an html element both horizontally and vertically with top and side labels scrolling correctly

    How to blur a banner photo in CSS Style?

    How do I overlap PNG images for a “build your own t-shirt” product display page - javascript/css/asp

    How to arrange subchild in the horizontal menu

    how to do css styling

    How can I create HTML/CSS responsive tile?

    How to align image to top left of div

    How to make a width binding in CSS

    CSS: How to align table data

    How do I interact with @font-face definitions using the Chrome debugger?

    How to center text over an image while keeping it below fixed nav bar in css?

    Dropdown Menu doesn't show all links and can't change css social media icons color

    How do I display content in a way like UICollectionView on the web?

    How to Set Banner-Like Background Image With CSS

    How to debug CSS in Android native browser?

    How to move an image up and down smoothly with CSS?

    How do I override inline CSS with Class CSS? [duplicate]

    How to use CSS spinner in Angular2 while loading asynchronous list?

    How to use objects returned by a function?

    How do I append jumping dots to a text in html and css