jQuery FadeIn/Out Attributes -
i able modify code below fadeout , fadein removal , adding of style attribute body_id.
i know can fade whole of body_id animate removal , adding of style attribute not inside id itself?
$(".bg").click(function(){ var1 = $(this).attr('id'); loc = "background-image:url(" + var1 + ")" $("#body_id").removeattr("style").attr("style", loc + ";"); $.cookie('pagebg', loc,{ expires: 7, path: '/'}); return false; });
not possible in case, since we're talking background-image
here, , there's no way change opacity of background-image
through css.
you can either change master opacity (.fadein
/.fadeout
) of element or use separate element positioned in same position background , fade instead.
separate cleanup of current code:
$(".bg").click(function(){ var bgurl = this.id; $("#body_id").css('backgroundimage', bgurl); $.cookie('pagebg', bgurl, { expires: 7, path: '/'}); return false; });
remember change part of code reads out cookie too.
Comments
Post a Comment