Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2013
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using Jquery to resize text automatically.

    Hi Guys, I am looking for some help, as I would like to resize text automatically based on width. I was going to use this here, http://fittextjs.com/ however I am not really sure how. Here is my HTML below.

    Thanks for the help in advance.

    As you can see I added,

    Code:
    <script>
      window.fitText( document.getElementById("responsive_headline") );
    </script>
    but it didnt work


    Code:
    <!doctype html>
    <html>
    <head>
    <title> DV Custom Sabers </title>
    <meta charset="utf-8">
    <link type="text/css" rel="stylesheet" href="style/buildlog.css" />
    
    </head>
    <body>
    
    
    	
    <div class="header"><a href="index.html">Darthvix Custom Sabers</a></div>
    
    <div class="header1">DV Custom Sabers is the place to go for your saber needs!</div>
    
    <div class="logo"><a href="index.html"><img src="images/logo.png" alt="schedule" height="200" width="350" border="0"></a></div>
    
    <ul id="nav">
    	<li><a href="index.html">Home</a></li>
    	<li><a href="aboutme.html">About Me</a></li>
    	<li><a href="services.html">Services</a></li>
    	<li><a href="Gallery.html">Gallery</a></li>
    	<li><a href="kotorsale.html">For Sale</a></li>
    	<li><a href="buildlog.html">Build Log</a></li>
    </ul>
    
    <div class="buildlog"> Build Log </div>
    
    <div class="build">
    <span class="build">Current Projects(In progress)</span>
    <p> </P>
    <span class="build1"> Updated 9/28/13 10:00AM </span>
    <p> </P>
    <span class="build2"> This is a list of current projects on my bench, and future projects in mind. </span>
    <p> </P>
    
    
    <span class="status"> Current Build Log: Closed: </span>
    <p> I try to update my build log as I finish builds In-progress.</p>
    
    <span class="bench"> On the Bench:</span>
    <ol class="d">
    	<li>LDM Luke V2- Upgrading to CF5, 10W RGGB LED and 2W speaker.</li>
    	<li>One Replica Kit Fisto Hilt- Getting the suite treatment</li>
    </ol>
    <span class="ondeck"> On Deck:</span>
    <ol class="d">
    	<li>2X Rebellion Jacen Solo Upgrade-Accents, Cf6, Cex, LED, etc.</li>
    	<li>One Replica Ki-Adi Mundi-Suite Treatment</li>
    	<li>Custom krayt Saber</li>
    	</ol>
    	
    <span class="smalljob"> Current Small Jobs:</span>
    <ol class="d">
    	<li>Soundboard Upgrade on MHS Hilt</li>
    	<li> Lighted Accent Switchs (X4)</li>
    	</ol>
    </div>
    
    <script>
      window.fitText( document.getElementById("responsive_headline") );
    </script>
    
    </body>
    </html>
    Last edited by VIPStephan; 10-11-2013 at 05:55 PM. Reason: corrected code BB tags

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,635
    Thanks
    6
    Thanked 1,003 Times in 976 Posts
    At the very first you should learn and understand at least basic JavaScript before using it. Then you should read the documentation that is provided before asking questions. Chances are that if you had done both, you wouldn’t even have landed here.

    Edit: Oh, I just see now that you are apparently using the non-jQuery version of the script. One more reason why you should learn and understand JavaScript before trying to use it.
    Now, the script must be applied to some kind of text. You just copied and pasted the demonstration code without changing the ID to which you want to apply the script. I don’t see any element called “responsive_headline” in your code. Also – another sign that you don’t even know what you are doing just yet – you didn’t even put the reference to the script itself in the document header so no wonder that nothing is happening.
    Last edited by VIPStephan; 10-11-2013 at 06:03 PM.

  • #3
    New Coder
    Join Date
    Sep 2013
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    is jquery the best thing to do this with, as well as images?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •