Breaking News
Loading...
, ,

Zooming with jQuery and CSS.

Share on Google Plus




Javascript Code

Contains javascript code. $("#zoom").change(funtion(){}- zoom is the id name of the select box. Using $("#zoom").val(); calling select box value. Applying style at $("#main").css

$(document).ready(function(){
$("#zoom").change(function() 
{
var size = $(this).val();
$("#main").css('font-size', size+'px');
return false;
});
});

This is a Simple JQuery Tutorial using the .css() and .change()

<select id="zoom">
<option value="25">25 </option>
<option value="50">50 </option>
<option value="75">75 </option>
<option value="100">100 </option>
<option value="150">150 </option>
<option value="200">200 </option>
</select>

<div id="main">
Website Content
</div>

  The above is the Html Content and it has a select box #zoom with some values and the div with id #main along with the content "Website Content". In the select box each of the option having some different set of values in that while changing the select box the jquery script will trigger at the time the value of the select option will get and then using  the div #main id we are changing the div font-zise using the .css() function.

See the Pen pvWyQE by Arun Yokesh (@yokesh) on CodePen.

You Might Also Like

0 comments

About me


Like us on Facebook