0

I have tried in-vain to find a resolution online to my problem. I have two buttons, one a + sign and the other a - sign. I would like to allow users when pressing the + button, to emulate the CTRL & + keys being pressed and when pressing the - button, to emulate the CTRL & - keys being pressed.

Any assistance would be so very gratefully received, many thanks.

Ataur Rahman Munna
  • 3,887
  • 1
  • 23
  • 34
Jules
  • 1
  • 1

2 Answers2

0

Not sure I entirely understand the question but I've used this in the past with success. Check it out: http://jaukia.github.io/zoomooz/

AndrewLeonardi
  • 3,351
  • 9
  • 47
  • 100
0

$(function() {
  
  var step = 0.2;

  $('.larger').click(function() {
    $('body *').each(function() {
      var actualSize = parseInt($(this).css('font-size'), 10);
      var newSize = actualSize / 10 + step;
      $(this).css('font-size', newSize+'rem');
    });
  });
  
  $('.smaller').click(function() {
    $('body *').each(function() {
      var actualSize = parseInt($(this).css('font-size'), 10);
      var newSize = actualSize / 10 - step;
      $(this).css('font-size', newSize+'rem');
    });
  });
  
});
html {
  font-size: 62.5%;
}
body {
  font-size: 1.6rem;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button class="larger">+</button>
<button class="smaller">-</button>
<h1>TEST</h1>
<p>
  lorem ipsum
</p>