Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8344881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:30:35+00:00 2026-06-09T06:30:35+00:00

I have a font resizer that needs to be contained in one link. eg.

  • 0

I have a font resizer that needs to be contained in one link. eg. show text link “Larger Type” and switch to text link of “Smaller Type” when clicked. I am not sure why it will toggle the class “plus/minus” but it will not switch the text or call the font resize function after the else statement?

Currently, it works the first click to resize the text and add the minus class but after that it does nothing.

http://jsfiddle.net/infatti/P6SVv/

var targetContainers = $('.two-thirds');
var newLargerSize = 16;
var newSmallerSize = 14;
$('.resize-font a').click(function(){

if ($(this).hasClass('plus')) {

    $(targetContainers).css('font-size', newLargerSize);

    $(this).text('Smaller Type').toggleClass('minus');

} else {

    $(targetContainers).css('font-size', newSmallerSize);

    $(this).text('Larger Type').toggleClass('plus');

};

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:30:38+00:00Added an answer on June 9, 2026 at 6:30 am

    Your condition is not calibrated with your toggle.

    You check if the a has the class plus, but if it does, you never remove the plus, you remove (or add) the minus.

    You should toggle plus always, to remove it when it exists, and add it when it doesn’t:

    $('.resize-font a').click(function() {
       var hasPlus = $(this).hasClass('plus');
       $(targetContainers).css('font-size', hasPlus ? newLargerSize : newSmallerSize);
    
       $(this).text(hasPlus ? 'Smaller Type' : 'Larger Type').toggleClass('plus');
    });
    

    If you need the minus for styling, you should toggle both, at all times:

    $(this).text(hasPlus ? 'Smaller Type' : 'Larger Type').toggleClass('plus minus');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JLabel that needs to display some html-formatted text. However, I want
I currently have a line of text that has a default font-size of 24.
Anyone know why CSS provides color for text, but does not have font-color or
Html text box should have same font size for both upper and lower case
I have text with font in org.faceless.pdf.PDFFont. How can I get width of it
i have a blue container that is the canvas for my text. what i'm
I have a few users who complain that the font size on my web
I have added one image (it is a nice painted box type thing rectangular
I have an application that changes the font of every control to SegoeUI when
I have text widgets that can be added on the page. A click should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.