Solved

Font Size Increase/Decrease

Posted on 2015-01-05
5
101 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 42

Expert Comment

by:Rob Jurd, EE MVE
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 42

Accepted Solution

by:
Rob Jurd, EE MVE 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 42

Expert Comment

by:Rob Jurd, EE MVE
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Safari SVG Image Problem 1 20
Box Model and Styling 12 21
Bootstrap 3 icons 3 12
Asp.net mvc foreach 3 0
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now