Increase font size of whole web page on button click event using jquery

前端 未结 6 2005
说谎
说谎 2021-01-16 10:02

I want to increase font size in whole page when user click on increase button. It will be increase on bases of current font size. Following is sample code :

         


        
6条回答
  •  萌比男神i
    2021-01-16 10:45

    You can simply change font size of the body of whole page in a button click as below. here i changed the font-size in percentage.

    $("#sizeUp").click(function() {
    
            $("body").css("font-size","70%");
    
     });
    

    If you want to change each element size with some amount in each button click, then follow below coding..

      $('body *').each(function() {
          xsize= parseInt($(this).css('font-size')) + 1;    
            $(this).css('font-size', xsize+2);
      }); 
    

提交回复
热议问题