Reputation: 17530
i want to write a code where a list will be shown to the user, the user can select any font from the list, on choosing a font, the content of the page will be rendered with that font face ! dont know how to do that :(
Upvotes: 1
Views: 215
Reputation: 14390
$("#changeFont").change(function(){
$("*").css("font-family",this.value);
});
Change font is a dropdown like this
<select id='changeFont'>
<option value='Arial'>Arial</option>
......
</select>
Upvotes: 1
Reputation: 15461
I recommend writting your CSS like this:
body.arial {font-family:arial;}
body.tahoma {font-family:tahoma;}
and then just use JavaScript to change the body's class when the user selects the font.
$(document.body)[0].className=SelectedFont;
Upvotes: 1