Increase the font size with a click of a button using only JavaScript

前端 未结 6 813
悲&欢浪女
悲&欢浪女 2020-12-09 22:45

I\'m attempting to increase the font size with the click of a button. I have got the first one to work but I can\'t get my head around the second one. The second one, every

6条回答
  •  无人及你
    2020-12-09 22:49

    Cycle through different font sizes by clicking on an element

    $(document).ready(function() {
      $("#ModelIDBarcode").click(function() {
        newFontSize = incSize($('.barcode').css("font-size"), 10, 5, 120)
        $('.barcode').css("font-size", newFontSize);
      });
    });
    
    function incSize(currentSize, incr, min, max) {
      fSize = (parseFloat(currentSize) + incr) % max + min;
      return (fSize) + 'px';
    }
    
    

提交回复
热议问题