Attempting to adjust the width of a text animation loaded with jQuery using Textillate, but encountering difficulties

I found a captivating animation on this website: http://codepen.io/jschr/pen/GaJCi

Currently, I am integrating it into my project.

#content {
    position: relative;
    margin-left: auto;
    margin-right: auto;
    width: 1000px;
    height: 700px;
}

#animation {
position: absolute;
z-index: 20;
width: 1000px;
height:50px;
top: 600px;
left: 350px;
}

#animation2 {
position: absolute;
z-index: 20;
width: 1000px;
height:50px;
top: -25px;
left: 340px;
}

Regarding the animation.css:

h1 {
  position: absolute;
  font: 12vmin/12vmin 'Special Elite', cursive;
  left: 0;
  top: 30%;
  margin-top: -4vmin;
  width: 100%;
  text-align: center;
  padding: 2vmin 0;
  text-shadow: 0.15vmin 0.15vmin rgba(0, 0, 0, 0.5);
}
In the main html:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<div id="content">
 <div id="animation"></div>​
 <script>
       $("#animation").html('<object data="./animation/animation.htm">');
 </script>
 <div id="animation2"></div>​
 <script>
       $("#animation2").html('<object data="./animation/animation2.htm">');
 </script>
</div>
And the animations that I load into the main html:

<head>
 <link href="https://fonts.googleapis.com/css?family=Special+Elite" rel="stylesheet"> 
 <link rel="stylesheet" href="animate.css" charset="utf-8" />
 <link rel="stylesheet" href="animation.css" charset="utf-8" />
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
 <script src="jquery.lettering.js"></script>
 <script src="jquery.fittext.js"></script>
 <script src="jquery.textillate.js"></script>
 
 
</head>
 
 <body>
 <h1 class="tlt">Hello to my website and welcome</h1>
<script>
$('.tlt').textillate({ 
  in: { effect: 'splat' },
  out: { effect:'hinge', sync: true },
  loop: true
});
</script>
 </body>

The second animation showcases a similar style.

The main concern is customizing the width to display the entire phrase with the font size set around 30px. The challenge lies in adjusting the font size for the two animations differently – for the first one, it's at 8vmin while for the second one, it goes up to 12vmin to keep the phrases continuous. When attempts were made to increase the font size further, it caused the string to break or get cut off depending on where the width was adjusted. Analysis revealed that the injected spans were only 300 wide whereas a width of about 700 was desired. Various online resources and CSS modifications were explored without success. Even playing with span injections and enlarging them did not yield positive results. Despite these setbacks, the quest continues to find a viable solution. Suggestions and guidance are welcomed. Thank you!

Answer №1

After some experimentation, I discovered that I can achieve the desired result by making a simple adjustment to my code. Here's what worked for me:

<script>
       $("#animation").html('<object width="600px" data="./animation/animation.htm">');
 </script>

By increasing the width parameter inside the object data, I was able to get the outcome I wanted.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can you use JavaScript/jQuery to scroll to the top of a DIV?

When a link is clicked, I have a <div> popup that appears. This popup contains scrollable content when there is overflow. If the same link is clicked again, I want the <div> to be positioned at the top of the scrollable area. While this functi ...

A guide to resolving the issue of invalid objects as a React child in Nextjs13

Seeking help on resolving an issue in Nextjs13, where I'm encountering the error "objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead" The scenario involves fetching ...

Is there a way to send URL variables to express.js similar to how it's done in PHP?

Currently in the process of converting my PHP website to Express.js. There are numerous scripts on my frontend that generate links in the format page.php?id=10&something=anything. Is there a way in Express.js to capture variables from URLs structured ...

retrieve data from JSON file

function retrieveDataFromProfiles(){ const fs = require('fs') fs.readFile('src/data/profileInfo.json', function(error, data){ if(error){ alert(error); } var profileData = JSON.parse(data); //retrieves the JSON data of ...

Is it possible to arrange a react map based on the length of strings?

I am working on a React function that loops through an object and creates buttons with text strings retrieved from the map. I want to display the text strings in order of their length. Below is the code snippet for the function that generates the buttons: ...

How to implement a pop-up dialog box with multiple input boxes using AngularJS?

If you click on the link below: https://material.angularjs.org/latest/demo/dialog You'll notice that the prompt dialog box features only one input field. I'm curious to know if it's possible to customize this using mdDialog to include mult ...

What steps are needed to pass an additional parameter to the onMouseDown function in ReactJS?

The TypeScript function listed below demonstrates the functionality: const handleMouseDownHome = (e: any) => { // Only activates when scroll mouse button is clicked if (e.button === 1) { window.open("/", "_blank", " ...

Tips for securely concealing an API key during website deployment on Netlify

Recently, I created a small website using Javascript just for fun and I'm looking to deploy it to Netlify. However, I've encountered an issue with the API key that the website uses. I'm struggling to figure out how to conceal this key. Curre ...

Can IE Conditional Comments have a negative impact on page speed?

Debates between "CSS hacks" and "Conditional Comments" have become a regular occurrence for me lately, so I wanted to hear the thoughts of the Stack Overflow community on this topic. <!--[if IE]> <link type="text/css" rel="stylesheet" href="ie-s ...

Utilizing Selenium and JavaScript to discover and extract the subject fields within a table

In my sent message list, I am trying to display the subject fields of all messages using Selenium and JavaScript (not Java) for coding. Here is the code snippet: <table class="messages"> <tbody><tr class="section-heading"> < ...

Obtain user input and extract the name using jQuery's serialization function

Trying to extract user input from a dynamic form using jquery serialize. The structure of my form is as follows: <form id="lookUpForm"> <input name="q" id="websterInput" /> <button onclick="webster(); return ...

Is it possible for JavaScript code, within an AJAX-returned page, to invoke a function that originally resided in a JavaScript file on the initial page using jQuery?

I have come across this code snippet: <!doctype html> <html> <head> <meta charset="UTF-8> <title>JQuery Test</title> <script type="text/javascript" src="js/jquery-1.5.1.min.js"></script> ...

Exploring the Power of JQuery Load and CSS styling

Currently, I am dynamically loading text into a div. However, I am encountering an issue where the content below this div is constantly shifting depending on the loaded text. Is there a way to restrict the space allocated to the div with the dynamic conte ...

js/jquery Asynchronous Loading of Content Replaces Existing Page Content

I have encountered a problem that I am hoping someone can assist me with. Here is the issue: A partner of mine has given me a code to use on my website, which will display certain content that I am interested in. However, this content is only relevant to ...

Achieving overlapping of a <div> element with a "position: fixed" container while enabling vertical scrolling of the fixed container's content

In my single page application, I have a fixed container and I am trying to make one div inside this container overlap the boundaries of the fixed container while also vertically scrolling with its contents. Unfortunately, I have only been able to achieve e ...

Arrange two absolute divs side by side without overlapping each other

I have a specific layout configuration: <div id="container"> <div class="left"> 1 </div> <div class="left"> 1 </div> <div class="right"> 2 </div> </div> My goal is to stack the left divs on top ...

Insufficient Resources Error (net::ERR_INSUFFICIENT_RESOURCES) encountered while executing jQuery script with multiple ajax requests for 2 minutes

Upon initially loading the code below, everything seems to be functioning smoothly with the dayofweek and hourofday functions. However, shortly thereafter, the browser (Chrome) freezes up and displays the error message: net::ERR_INSUFFICIENT_RESOURCES. Thi ...

Activate month input programmatically

Having an issue trying to open a month popup using jQuery trigger. I have a button and an input of type month, but when the button is clicked, the popup does not open as expected. You can find the fiddle for this question here. $(document).ready(functio ...

Guidance on Configuring Django Static Files

For setting up my Django static files, I added the following code to settings.py: STATIC_URL = '/static/' STATIC_DIRS = [ os.path.join(BASE_DIR, 'static') ] STATIC_ROOT = os.path.join(BASE_DIR, 'assets') To implement this ...

What are some ways to implement a pre-execution step, such as an interceptor, before Nextjs runs getStatic

When working with getStaticProps and getServerSideProps in Next.js, I need to intercept and add common header properties to all request calls that are executed server-side. axios.interceptors.request.use(function (config) { // Perform actions before ...