- 0
Javascript - Determine length of text in pixels
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By Aditya Tiwari · Posted
Apple iOS 26 beta has a hidden iPhone ringtone by Aditya Tiwari If you're waiting for a new iPhone ringtone to attend your calls, Apple might be baking something for this year. The recently announced iOS 26 update hides a new ringtone for iPhone, discovered in the source code of its first developer beta. Details about the new iPhone ringtone called "ReflectionAlt1-EncoreRemix" were posted on the social media platform X by @8810cfw. It was later re-shared by known Apple leaker @ShrimpApplePro and confirmed by @aaronp613. Looking back a few pages in tech history, Apple's ringtone journey began with the first iPhone in 2007. The Cupertino giant included the classic Marimba ringtone as default, which became a signature for Apple fans. Since then, Apple has continued to release new ringtones and system sounds over the years. However, it exerted more control over iPhone ringtones during the initial years. In addition to the ringtones preloaded on iPhones, Apple also allows users to buy new ringtones from the iTunes Store app. Users can also create their own custom ringtones from an audio file or a song from Apple Music using the GarageBand app. Not just Apple, tech companies have long used ringtones as a way to differentiate their devices from the rest. This includes the fallen warrior, Nokia, and newer competitors like the Google Pixel, which got a new Sound Matters collection last year. The unreleased iPhone ringtone isn't directly available to users in the Settings app as part of the developer beta. It's an alternative version of the Reflection ringtone that has been present on iPhones as the default since 2017. While it's being speculated that the ringtone could be exclusive to this year's iPhone 17 series, it's unclear if Apple will include it in upcoming iOS 26 beta releases. Apple will release the iOS 26 update later this year, featuring a range of new features, including a revamped Photos app, new iPhone wallpapers, and the Vista-like Liquid Glass design. Its public beta is expected to arrive sometime during the next month. -
By ZipZapRap · Posted
Windows Phone was ahead of its time -
By pmrd · Posted
This article is about the start menu not the start button -
By soulburner · Posted
This is why I wasn't really annoyed with Windows 8's full screen Start. Since Vista I launch programs by quickly pressing the WIN key and typing first few letters of whatever it is I need. Honestly, my personal equivalent of the Start menu is the WIN+X menu - it truly contains some useful things I do not feel like typing into Search. -
By BlueScreenJunky · Posted
No and no. Didn't read the article but my take is they should remove the start menu altogether and replace it with Powertoys Run
-
-
Recent Achievements
-
KynanSEIT earned a badge
One Month Later
-
gowtham07 earned a badge
One Month Later
-
lethalman went up a rank
Collaborator
-
Wayne Robinson earned a badge
Week One Done
-
Karan Khanna earned a badge
One Month Later
-
-
Popular Contributors
-
Tell a friend
Question
jordan.
Hi all,
A while ago I had someone create a sliding bar effect for a website I was working on. If you check out the site linked below, you will see the sliding bar thingy that I am talking about where it says "Tona Boards" on a sort of green arrow, then it slides back and forth to reveal different text.
http://www.tonaboards.com/
Now there is just one small problem with it. There is always this unnecessary amount of extra space after the text if the line of text is quite long. This is a result of a poor calculation for the width of the arrow. Currently this is how the width of the arrow is calculated:
var width = titles[title_id][0].length * 15;
Basically, he is just multiplying the number of characters by 15 to get a close (but not accurate) pixel width that will fit the text.
Is there a better way to work out the exact amount of pixels a line of text takes up? I did some googling and it seems possible but I am a javascript noob and can't figure out how to incorporate any of the examples in to my particular code.
Here is the full javascript for the sliding arrow.
http://www.tonaboards.com/wp-content/themes/TonaLife/arrow.js
Cheers for any help.
Jordan
Link to comment
https://www.neowin.net/forum/topic/935436-javascript-determine-length-of-text-in-pixels/Share on other sites
8 answers to this question
Recommended Posts