Dev.Opera - Follow the standards, break the rulesDev.Opera - Follow the standards, break the rules

Login

Lost password?

Forums » Article Discussions

Discuss the articles posted at DevOpera

Note: You need to login to post in the forums. if you don't have an account you first need to sign up.

By Benjamin Joffe O anchor Wednesday, 31. October 2007, 11:59:09

Media Query library

Created by Opera's Benjamin Joffe, this rather useful little library allows you to detect the media capabilities of the browser/device setup being used to view your site.

( Read the article )

By mr7clay anchor Thursday, 1. November 2007, 21:25:27

avatarThis might be more useful if it returned null in the case that media queries don't seem to be supported. I imagine general MQ support could be roughly tested by a generally always-pass query like "(color)". If (color) fails, return null, o/w continue w/ test.

Also, if null is returned, the function should probably overwrite itself to always return null, in case it's called more than once;

By jmudya anchor Thursday, 15. November 2007, 11:20:50

avatarFor some reason for me nothing turns out. (var handheld = testMediaQuery(handheld):wink: --- var test = testMediaQuery(tv and (max-height: 400px)); Does can I that not so do that?

By Benjamin Joffe O anchor Thursday, 15. November 2007, 17:11:25

avatarmr7clay: You have a very good idea there, I plan to implement it in the next version, thank you!

By Benjamin Joffe O anchor Thursday, 15. November 2007, 17:11:56

avatarjmudya: Hi, it looks to me like you simply forgot to put quotation marks around your argument. For instance try this:

var handheld = testMediaQuery("handheld");
var test = testMediaQuery("tv and (max-height: 400px)");

Moderators: jax | malware | mcx | operadev