Friday, 15 June 2012

javascript - How can Modernizr load a (Modernizr)class conditionally with css? -



javascript - How can Modernizr load a (Modernizr)class conditionally with css? -

i checking how css expressions modernizr classes work.. , see on google dev. tools below:

//normal css .box{ width:100px; height:100px; border-radius:20px; background:blue; //as modernizr detects no support.. .no-borderradius .box{ background:url(radiusyimage.png); }

'radiusyimage' not add together http request.. know possible(load source necessary) js:

if (!modernizr.borderradius) { //load img or pollyfill.. }

but how possible css? how work actually?

current browsers don't request images won't utilize in html see question.

since modernizr add together no-borderradius class if browser doesn't back upwards attribute, modern browser won't have dom element matching .no-borderradius .box therefore, image not load.

the drawback here have few more lines of styles in css, impact unnoticeable.

javascript css modernizr

No comments:

Post a Comment