Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Font Size Increase/Decrease

Posted on 2015-01-05
5
112 Views
Last Modified: 2015-01-15
Hello,

I have a website and I need put in a increase font section... i have the three graphics already inplace but I don't know how to make the buttons work....   Can anyone help with the code for this??

Here is the website address for the site i am using..

ckhatest.jadeddesigns.ca

Thank you,
0
Comment
Question by:cookmyster
  • 3
  • 2
5 Comments
 
LVL 43

Expert Comment

by:Rob
ID: 40532613
With jQuery:

I've used * for all elements, however you may want to just to p elements or divs or spans etc
jQuery(function() {
jQuery('#id_of_increase_btn').on('click', function() {
// to increase
jQuery('*').css('font-size', function(i, size) { return parseFloat(size)*1.2; });
});    

jQuery('#id_of_decrease_btn').on('click', function() {
// to decrease
jQuery('*').css('font-size', function(i, size) { return parseFloat(size)/1.2; });
});

});

Open in new window

0
 
LVL 43

Accepted Solution

by:
Rob earned 500 total points
ID: 40532620
0
 
LVL 2

Author Comment

by:cookmyster
ID: 40533389
Hey Rob,

when i put the javascript into a .js file and call it form the page I am working on... it doesn't seem to work.. but when i put al the javascript on the same page.. it works??  not sure what i am doing wrong

Rich
0
 
LVL 43

Expert Comment

by:Rob
ID: 40533464
Yeah it shouldn't matter so how are you including it and where in your page?
Is the code exactly the same whether in the page or in an external file?
Regardless the code has to be within a $(function() {...}) initialization or a function that is called after the page had loaded.
0
 
LVL 2

Author Closing Comment

by:cookmyster
ID: 40552174
Awesome!!!  thank you very much
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Json Schema 8 32
How do I show metrics with PHP or Javascript 6 32
what is the best Integrated development environment 2 20
CSS Style Effect 2 7
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question