Scripted Text Resize Tool Will Not Work in Firefox
I've created a text resizing tool (option) at the top a web page. My code works perfectly in all major browsers with the exception of Firefox.
Scenario:
There is a "<div>" containing the text "Text Size", and two .png's floating to the right of that text ("Text Size"). When you click on the text "Text Size", the text nested within an article (id = "article1") should return to the default "fontSize" if not currently the default "fontSize". When you click on the first image, a minus symbol, the text nested within this article (id = "article1") should become smaller in pixel size down to "8px". When you click on the second image, a plus symbol, the text nested within the same article should become larger in pixel size up to "24px".
In Firefox only, the proceding code will result in absolutely nothing upon clicking on either the text "Text Size", the minus symbol image, or the plus symbol image.
The following code includes the javaScript and valid XHTML. A link to the webpage concerning this example is to follow in my next post, in the morning once I've uploaded the latest files to the server.
CODE:
Javascript:
//variables for the text sizing feature.
var totalArticles = 1;
var defaultTextSize = 12;
var currentTextSize = defaultTextSize;
//Intializes the text sizing feature.
function initializeTextSizers() {
var defaultTextSizeLink = document.getElementById("defaultTextSize");
var decreaseTextBtn = document.getElementById("decreaseTextBtn");
var increaseTextBtn = document.getElementById("increaseTextBtn");
//text to change in "article1".
<p>Chiropractic is a health care approach that focuses on the relationship between the body's structure—mainly the spine—and its functioning. Although practitioners may use a variety of treatment approaches, they primarily perform adjustments to the spine or other parts of the body with the goal of correcting alignment problems and supporting the body's natural ability to heal itself.</p>
Update: Scripted Text Resize Tool Will Not Work in Firefox
I figured out what was causing this feature to not work in Firefox.
Solution:
I decided to take all the "...style.cursor..." instances out of my javaScript code. I saved the .js file, then refreshed my webpage in Firefox, and "magic", the text resize feature works now in ALL browsers!
One thing though, everytime I use this feature by clicking on the action buttons ("Text Size", +, -), In Opera 9.64, an annoying context popup menu keeps appearing, and I'm only left clicking.
I have attached a cropped screenshot of what is happening when I click on any of the three text resizing links.
This happens when clicking on them too quickly. There are only no problems when I click slowly. Other browsers do not have this problem. I am using Opera 9.64.
Oh, I just noticed that Fang said "What you are seeing is the double-click action."
Yes, that is true, but no other browsers do this. The "double-click action" is a very undesired effect. Do I need to specify that nothing should happen during the ondblclick event?
Bookmarks