javascript - get css value on media query change via enquire.js -


enquire    .register('screen , (min-width: 1200px)', {      match: function() {        active_li_margin_left = $('li.active').css('margin-left')       active_li_width = $('li.active').width()        console.log(active_li_margin_left, active_li_width)        zwarovsky();      }    })    .register('screen , (min-width: 980px) , (max-width: 1199px)', {      match: function() {        active_li_margin_left = $('li.active').css('margin-left')       active_li_width = $('li.active').width()        console.log(active_li_margin_left, active_li_width)        zwarovsky();      }    }) 

li.active width change 770px 620px, margin-left -30px -20px, bootstrap span8 items.

the problem: seems enquire fire functions before css media query, pickup previous values when resize window.

when switch 1200 980 resizing browser window console log show 30px 770 instead 20px 660, , when switch 980 1200 console log show 20px 620.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -