How to set session variable in jquery/css? -


jquery(document).ready(function($){     $("#a2").click(function(){         $('body').css("csstext","font-size: 107% !important");     }); });  jquery(document).ready(function($){     $("#a3").click(function(){         $('body').css("csstext","font-size: 114% !important");     }); });  jquery(document).ready(function($){     $("#a4").click(function(){         $('body').css("csstext","font-size: 121% !important");     }); }); 

i have given a2, a3, a4 ids a, a+, a++ buttons. whenever visitor of site click on 1 of these buttons, font-size of whole site change accordingly. right font-size changing when refresh page, again showing default font-size. how can that? need use session? , how can use in css or jquery ? new in website development. please me.

following code have written , working perfectly. sharing other can refer it.

jquery(document).ready(function($){     var fontcookie = get_cookie('fontclass');     if(fontcookie) {         jquery('body').addclass(fontcookie);     }     $("#a2").click(function(){         jquery('body').removeclass('body-18');         jquery('body').addclass('body-16');         var = new date();             var time = now.gettime();             time += 3600 * 1000 * 700;             now.settime(time);             document.cookie =              'fontclass=body-16' +              '; expires=' + now.togmtstring() +              '; path=/';         event.preventdefault();     }); }); 

like have added function a1 , a3 in adding , removing css classes per requirement.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -