Live Demo
Hello everyone!
Today i learned a small but interesting and important task this is how to re-size the font .
Write the below code in to your deault.aspx page.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Resize Fonts</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function () {
var divtxt = $('#f_div');
//
Increase Font Size
$('#btnincfont').click(function () {
var curSize = divtxt.css('fontSize');
var newSize = parseInt(curSize.replace("px", "")) + 1;
$(divtxt).css("fontSize",
newSize + "px");
});
//
Decrease Font Size
$('#btndecfont').click(function () {
var curSize = divtxt.css('fontSize');
var newSize = parseInt(curSize.replace("px", "")) - 1;
$(divtxt).css("fontSize",
newSize + "px");
})
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="f_div">
hello
this is a test page having test text
<br />
just to show you the code demo
to
make fonts large and small.
<br />
<br />
Click on "+" symbol to make fonts large or
<br />
CLick on "-" symbol to make fonts small.</div><br />
<input type="button" id="btnincfont" value=" + " />
<input type="button" id="btndecfont" value=" - " />
</form>
</body>
</html>
Thanks.
No comments:
Post a Comment