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

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -