Sliding Text Effect using JQuery

I am looking to create a text animation that slides in from the left. The text should include three fields: Sports Cargo Bag, $14, and Sale $25.

I want to achieve this effect using jQuery, similar to the animation in this example. Here is my current code on JsFiddle. While I have set up the headline texts, I would like to utilize a jQuery method for setting these texts dynamically.

html

 <div id="mainContainer">

    <div id="logdo">
     <img  src="http://i.share.pho.to/7346a9ca_o.gif"/>
    </div>
         <div id="images">
        <img id="introImg" src="http://i.share.pho.to/9064dfe4_o.jpeg"/></div>
    <div id="headlineText">
        <p id="headline1Txt" ></p>
        <p id="headline2Txt" ></p>
   <p id="headline3Txt" ></p>


    </div>

    <button class="btn btn-primary" id="ctaBtn" type="button">SHOP NOW</button>

        </div>

css

* {
    margin:0;
    padding:0;

}



#mainContainer{ text-align: center;
width:160px;
    height:600px;
 box-sizing:border-box;
  -moz-box-sizing:border-box;
  -webkit-box-sizing:border-box;
    border:5px solid #BACAE4;

    overflow: hidden;
    position: fixed;

}

#images{
    position:absolute;
    top:200px;
    left:3px;
    right:1286px;
    Width:130px;
    height:152px;

}
#introImg{
    position:absolute;
    top:40px;
    left:7px;
    right:11px;

}
#headlineText p
{
    text-align: center;
    position: absolute;
   top:60px;
    left:-120px; 
Width:120px;
    height:269px;
 line-height:1.0;
    overflow:hidden;

}

#ctaBtn{
        position:absolute;
    top:540px;
    left:26px;
    right:0px;
    Width:106px;
    height:28px;

}

Answer №1

Let's go over an easy technique:

To streamline the process, swap out all of your existing javascript in the fiddle with

$("#mainContainer").fadeOut().fadeIn('slow');
.

If you prefer, you can incorporate a delay of half a second before the animation starts:

$("#mainContainer").fadeOut().delay(500).fadeIn('slow');

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

Animations with the -webkit- prefix

I recently came across some CSS code that used the -webkit- prefix inside both @keyframes and @-0webkit-keyframes. This was part of a project called animate.css Do you think this is necessary? ...

Adaptable layout - featuring 2 cards side by side for smaller screens

I am currently designing a webpage that showcases a row of cards, each featuring an image and a title. At the moment, I am utilizing the Bootstrap grid system to display 4 cards per row on larger screens (col-md-2), but my goal is to modify this layout t ...

Having trouble navigating back to the homepage

Recently, I started following a tutorial on YouTube to create a basic frontend in React with Bootstrap. However, I encountered a roadblock while trying to implement a specific functionality. The issue stemmed from the fact that react-router-dom v6 no lon ...

The website operates smoothly when run locally, but encounters errors when deployed on GitHub and CodePen

The WeatherApp featured here leverages the OpenWeatherMap API to display a selected few weather results. I tested the code on my local system and then uploaded it to a GitHub repository to further examine it as a webpage. To my surprise, the code didn&apos ...

Is it possible to create a fixed position shader background in three.js?

Trying to incorporate a pixel shader as a background in three.js without affecting the camera rotation with OrbitControls. Most implementations use a 2D plane, but I want it to remain fixed in the scene. Is there a way to achieve this with two separate can ...

Can simply adding Bootstrap CDN make a website responsive?

Is Bootstrap truly self-sufficient when it comes to responsive design, or do custom webpages utilizing Bootstrap require additional responsive instructions? If I incorporate the Bootstrap CDN and utilize its built-in components, can I assume the webpage ...

"IOS exclusive: Encounter INVALID_STATE_ERROR on IOS devices only, not on Android, OSX, or Windows platforms

While developing an HTML5 web page with audio functionality using JavaScript, I encountered an issue. Initially, the basic version of my webpage successfully loaded and played audio files in different formats (e.g., ogg vs mp3) across various OS/browser co ...

Verify the status of the mongodb server synchronously

Is there a method to detect if a mongod instance is still operational while using mongoclient? In my mongoclient module, I have implemented a db.on('close') handler which functions properly when mongod exits normally. However, if the server proc ...

Transforming a JavaScript map into an array of objects

Given a map of key value pairs that I cannot control, I am tasked with converting them into an array of objects in a specific format. let paramArray1 = []; let paramArray2 = []; paramArray1.push({username:"test"}) paramArray1.pu ...

Experiencing [$resource:badcfg] error in Angular JS while testing $resource.get function, yet no issues when used in the controller

My Article resource is set up like this: define(['services/index', 'services/Helpers'], function(services) { 'use strict'; services.factory('Article', ['$http', '$resource', 'AppConfig& ...

Automatically switch Twitter Bootstrap tabs without any manual effort

Is there a way to set up the Twitter Bootstrap tabs to cycle through on their own, similar to a carousel? I want each tab to automatically switch to the next one every 10 seconds. Check out this example for reference: If you click on the news stories, yo ...

An effective way to determine the size of a browser through javascript

In an effort to enhance the responsiveness of a website, I have included the following code snippet on one of my pages: document.write(screen.width+'x'+screen.height); However, I am encountering an issue where the code displays my screen resolu ...

I possess 9 captivating visuals that gracefully unveil their larger counterparts upon being clicked. Curiously, this enchanting feature seems to encounter a perplexing issue within the realm of web browsing

<style type="text/javascript" src="jquery-1.11.0.min.js"></style> <style type="text/javascript" src="myCode.js"></style> </body> //jquery is within my site directory on my desktop $(document).ready(function(){ //note: $("#ar ...

I am seeking a solution to this error that occurs whenever I attempt to call a function using a button

Issue " _ctx.hello is not a function TypeError: _ctx.hello is not a function at onClick._cache.<computed>._cache.<computed> (webpack-internal:///./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/vue-loader/di ...

What is the method for positioning the cursor at the beginning of a center-aligned placeholder within a contenteditable element?

Here is the code snippet I am working with: HTML: <div class="title" contenteditable="true" placeholder="Title"></div> CSS: .title { width: 500px; margin: 0 auto; text-align: center; } [contenteditable=true]:empty:before{ conte ...

What is the best way to display or conceal controls upon page initialization using a select element with a general class?

Within my webpage, I am dealing with multiple segments of code that closely resemble the following: <select name="color_type_name" class="color_type_select" id=$ > <option value="">no color</option> <option value="solid">so ...

What is the best way to create a smooth transition for the box-shadow of a div when hovering over it, causing it to fade in and out seamlessly

I'm exploring animations and experimenting with a div containing three box-shadows. My goal is to create a hover effect where the box-shadows fade in one after the other, starting with the closest one to the div. I also want them to fade out in revers ...

Tips for manipulating observableArray information retrieved through the $.getJSON method

Recently, I've started using knockout.js and I'm really enjoying it so far! While working in MVC4, I encountered a small issue. I had successfully implemented kojs with static data, but now I need to work with data passed from a controller via JS ...

automatically starting sound when the page loads

Hello everyone, I am attempting to have audio play upon opening or launching a page. I have used the window.onload function, but unfortunately the audio is not playing when the page loads, even though it plays correctly on blur and focus. I have attempted ...

jQuery datatable loses highlight after page refresh

I am currently working with a datatable that utilizes ajax to load data. var table = $('#example').DataTable({ "ajax": "xxxxxx.aspx", stateSave: true, "aLengthMenu": [ [10, 25, 50, 100], [10, 25, 50, 100] ], ...