/ Published in: jQuery
Let's you select the classes and apply the resize and line-height.
In the example:
a.zoom is the link who will trigger the function, and .div is text target
In the example:
a.zoom is the link who will trigger the function, and .div is text target
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(document).ready(function(){ $("a.zoom").click(function(){ var $speech = $('.div'); var currentSize = $speech.css('font-size'); var num = parseFloat(currentSize,11); var unit = currentSize.slice(-2); if(this.id == 'plus' && num <= 16){ num += 1; } else if(this.id == 'minus' && num >= 10) { num -= 1; } $speech.css('font-size', num + unit); $speech.css('line-height', (num+6) + unit); return false; }); });