javascript - Access a property of a css block from jquery -
i have site heavily based on javascript, still want let modified css.
take example... there div has opacity modified when on hover through jquery, designer able choose value of opacity.
thinking on creating block in css declare constants, example:
.constants_someid{ opacity: 0.5; }
and through jquery take opacity
var opacity = jquery('css:constants_someid').attr('opacity');
i don't know if way these constants declaration, thats came mind right now.
what guys think?
thanks,
joe
define them in javascript file instead:
var settings = { opacity: 0.5 };
that kind of syntax should easy enough designer modify. can use settings.opacity
.
you use $.extend
merge settings defined designer default settings:
var defaults = { opacity: 0.9, speed: 500 } settings = $.extend({}, defaults, settings); // returns { opacity: 0.5, speed: 500 }
Comments
Post a Comment