ginerjm Posted September 9, 2011 Share Posted September 9, 2011 I've tried everything I know. Want to increase the fontsize of a group of "classed" elements depending upon the device the user has. Recognizing the device is working; recognizing the elements with class="x" is working. But I can't get my font to increase. Funny thing is right after I modify the style, I put an alert and it even said that I had succeeded, yet the display doesn't show the change. I'm using this at this point: var p = getElementsByClassName("lblfont"); for(i=0;i<p.length;i++) { if (w<500) { setStyle(p[i],"fontSize","font-size","58px"); } } function setStyle(el, jsprop, cssprop, newval) { if (el.currentStyle) //IE { el.style[jsprop] = newval; } else if (el.style.setProperty) { el.style.setProperty(jsprop,newval); } else //try and get inline style { el.style[cssprop] = newval; } } [\code] Quote Link to comment Share on other sites More sharing options...
nogray Posted September 10, 2011 Share Posted September 10, 2011 replace setStyle(p[i],"fontSize","font-size","58px"); with p[i].style.fontSize = '58px'; and remove the entier function Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 10, 2011 Author Share Posted September 10, 2011 ok - I tried doing that, but it didn't perform the change in size. An inquiry on the object right after the new statement returns the original size value and the screen doesn't change either. Thanks for the try tho. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.