Guest User

Untitled

a guest
Dec 7th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. <!-- text size menu-->
  2. <div class="container">
  3. <div class="row">
  4. <ul class="pagination">
  5. <li>
  6. <a href="#" aria-label="bigger" id="bigger">
  7. <i class="fa fa-expand" aria-hidden="true"></i>
  8. <span>א</span>
  9. </a>
  10. </li>
  11. <li>
  12. <a href="#" aria-label="reset" id="reset">
  13. <i class="fa fa-ban" aria-hidden="true"></i>
  14. <span>א</span>
  15. </a>
  16. </li>
  17. <li>
  18. <a href="#" aria-label="smaller" id="smaller">
  19. <i class="fa fa-compress" aria-hidden="true"></i>
  20. <span>א</span>
  21. </a>
  22. </li>
  23. </ul>
  24. <!-- /.pagination -->
  25. </div>
  26. <!-- /.row -->
  27. </div>
  28. <!-- /.container -->
  29.  
  30. <!-- /text size menu-->
  31. <script>
  32. //font-size control
  33.  
  34. function font_change_size(element, size) {
  35. var init = parseInt($('body').css('font-size'));
  36. var current = parseInt(element.css('font-size'));
  37. var body = $('body');
  38. if( size == 'smaller'){
  39. var new_size = current - 2;
  40. } else if ( size == 'bigger'){
  41. var new_size = current + 2;
  42. } else if ( size == 'reset'){
  43. var new_size = init;
  44. }
  45. element.css('font-size', new_size + 'px');
  46.  
  47. }
  48. $('#smaller').click(function (e) {
  49. event.preventDefault();
  50. font_change_size($(body), 'smaller');
  51. });
  52.  
  53. $('#reset').click(function (e) {
  54. event.preventDefault();
  55. font_change_size($(body), 'reset');
  56. });
  57. $('#bigger').click(function (e) {
  58. event.preventDefault();
  59. font_change_size($(body), 'bigger');
  60. });
  61. </script>
Add Comment
Please, Sign In to add comment