Hi
What I meant was a resize event per MediaQueryList, if you look at www.simplestatemanager.com you would see that it allows your to have a enter, leave and resize event.
So if we think of this in terms of the MediaQueryList, we currently have
var mql = window.matchMedia("screen and (max-width:768px)");
mql.addListener(function(e){
if(e.matches){
console.log(‘matched');
}
else{
console.log(‘unmatched');
}
});
But what we might have instead is:
var mql = window.matchMedia("screen and (max-width:768px)”);
mql.addEventListener(“match”, function(){
console.log(‘ive matched’);
});
mql.addEventListener(“unmatch”, function(){
console.log(‘ive unmatched’);
});
mql.addEventListener(“resize”, function(){
console.log(‘while matched and browser is resized I will fire’);
});
So this gives us the ability to add a resize event specific to a “state” i.e. while the media query matches.
Thanks
Jonathan Fielding
Jonathan Fielding Ltd
@jonthanfielding
On 6 Aug 2014, at 15:19, Simon Pieters <simonp@opera.com> wrote:
> On Mon, 09 Jun 2014 22:22:54 +0200, Jonathan Fielding <hello@jonathanfielding.com> wrote:
>
>> Would be nice to be able to do addEventListener(“resize”, …) as well, I have mentioned this in previous threads because its really important to some responsive sites
>
> Do you mean when the viewport is resized? The spec already fires an event for that:
>
> http://dev.w3.org/csswg/cssom-view/#resizing-viewports
>
> --
> Simon Pieters
> Opera Software