implementing jquery typewriter plug-in for a responsive bootstrap image

I am using Bootstrap and my image response dynamically, but I am having trouble adding text to it. I would like to use a jQuery typewriter plugin for the text on the image, which should resize according to screen size. Here is my HTML code and I have used this jQuery plugin:

<div class="container-fluid">
<div class="row-fluid">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 centerimg">
<img class="img-responsive" src="img/headerBackground.jpg">
<div class="wrap">
<div class="type-wrap">
<div id="typed-strings">
<span>Typed.js is a <strong>jQuery</strong> plugin.</span>
<p>It <em>types</em> out sentences.</p>
<p>And then deletes them.</p>
<p>Try it out!</p>
</div>
<span id="typed" style="white-space:pre;"></span>
</div>
</div>
</div>
</div>
</div>

Here is the CSS I am using to position the text on my image:

.col-lg-12.col-md-12.col-sm-12.col-xs-12.centerimg{
display:block;
margin:auto;
position: relative;}
.col-lg-12.col-md-12.col-sm-12.col-xs-12.centerimg p{
position: absolute;
top: 2%;
left: 2%;}

I would greatly appreciate any assistance in achieving this. I want the jQuery plugin text on the image right in the center.

Answer №1

Don't forget to include the following JavaScript function in your code:

$(function() {
  $("#typed").typed({
    stringsElement: $('#typed-strings')
  });
});

You can find more information about it in the documentation on the official github repository. Remember to also add jquery to your project.

$(function() {
  $("#typed").typed({
    stringsElement: $('#typed-strings')
  });
});
.col-lg-12.col-md-12.col-sm-12.col-xs-12.centerimg {
  display: block;
  margin: auto;
  position: relative;
  max-width: 590px;
}
.col-lg-12.col-md-12.col-sm-12.col-xs-12.centerimg p {
  position: absolute;
  top: 2%;
  left: 2%;
}
#typed {
  color: #fff;
}
.wrap {
    position: absolute;
    transform: translate(0, 50%);
    top: 36%;
    left: 0;
    width: 100%;
    text-align: center;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/typed.js/1.1.4/typed.min.js"></script>
<div class="container-fluid">
  <div class="row-fluid">
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 centerimg">
      <img class="img-responsive" src="http://www.martin4sturgis.com/wp-content/uploads/2015/02/computerScreen.png">
      <div class="wrap">
        <div class="type-wrap">
          <div id="typed-strings">
            <span>Typed.js is a <strong>jQuery</strong> plugin </span>
            <p>It <em>types</em> out sentences.</p>
            <p>And then deletes them.</p>
            <p>Try it out!</p>
          </div>
          <span id="typed" style="white-space:pre;"></span>
        </div>
      </div>
    </div>
  </div>
</div>


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

Challenges arise with CSS alignment when adding d3.js charts to a webpage

I'm puzzled by the empty space that appears between the left column (highlighted in the image) and the header. This peculiar gap only seems to occur when the middle column is filled with a chart. I've scrutinized the code using Chrome Developer t ...

Send the checkbox value using ajax, jquery, and php

Hey everyone, I'm facing an issue and need some help. I am trying to send the value of a checkbox via AJAX to a PHP file. My question: I want to pass the checkbox value regardless of whether it is checked or not. If it is checked, then the value "tr ...

Tips on removing pesky favicons

Not too long ago, I purchased a domain and configured it with Wordpress. Eventually, I decided to switch to a static landing page so I uninstalled Wordpress. But now there's an unfamiliar favicon that has appeared on my site. Even after deleting all ...

Tips for incorporating a PDF file into a website when the Adobe Reader add-on is disabled in Internet Explorer

I attempted to insert a PDF into my website using the <embed> tag. Unfortunately, it doesn't seem to be functioning properly in Internet Explorer when the Adobe Reader add-on is disabled. Is there a solution that will allow it to work even if th ...

Using JQUERY to toggle classes conditionally

$('.showall').css("cursor","pointer").click(function() { $('.value-container').toggle(); $('.dim-header').toggleClass($('.dim-header').toggleClass() == 'dim-header' ? 'dim-header active' : & ...

Deselect all child elements when the parent checkbox is not selected

Creating a page that features multiple checkboxes, some nested and others not. When a particular checkbox is selected, additional options will be displayed underneath it for selection; if unchecked, the child boxes will be hidden. Currently, this functiona ...

Tips on removing a stylesheet while transitioning to another page in Vue

I'm new to Vue.js and I'm experimenting with adding and removing stylesheets in components using the mounted and unmounted lifecycles. Initially, I successfully added a stylesheet using the following code: mounted() { this.style = document. ...

Customize Loading Screen for Datatable Server-Side Processing

Currently, I am utilizing datatable with server-side rendering. The issue at hand is that by default Datatable displays a small processing message which becomes invisible if the loading records exceed 50 in the default view. I attempted to set an overflow ...

Adjust the left margin to be flexible while keeping the right margin fixed at 0 to resolve the spacing

To create a responsive design that adjusts based on screen size, I initially set the content width to 500px with a margin of 0 auto. This meant that for a 700px screen, the content would remain at 500px with left and right margins of 100px each. Similarl ...

Mysterious gap found between image and table

Hey there! I've been struggling with an unusual gap between a top image and a table on my website (www.tradecaptaincoaching.com). The table was created using . Despite spending hours on it, I can't seem to get rid of the huge 200 pixel gap that& ...

Enhance your Rails application by dynamically updating table cells with Ajax, eliminating the need for

In my index.html.erb file, I have set up one form and one table. Using Ajax allows me to submit the form without any redirects. <%= form_for approval, remote: true do |f| %> <%= f.check_box :pass %> <%= f.submit%> <% end %> My ...

Could the Error Detected by Siteimprove Regarding WAI-ARIA Criterion 1.3.1 be a Mistake?

When using the Siteimprove extension v. 126 for Chrome, the following HTML snippets are all showing an issue labeled "Input field has no description 1.3.1" Some may argue that a description is unnecessary because the aria-hidden attribute should effective ...

What is the best way to ensure an SVG maintains a fluid width while keeping its height constant?

My goal is to achieve the following: The SVG should dynamically scale its width to occupy 100% of the container's width. The SVG should either stretch or compress when the container's width changes, specifically affecting the wave drawn wit ...

redirecting from an AJAX request

Seeking a way to perform a redirect following an ajax `put` request. My intention is to implement client-side validation using pure JS. Client: $(document).ready(function() { login = () => { var username = $("[name='username']"). ...

What is the significance of the .jpg?t= in the URL?

This webcam image displays the code ?t=1512496926. What exactly does this code signify? Could it be related to time? Is it just a random string of characters? https://i.stack.imgur.com/ZAZMy.jpg ...

What is the best way to send information from a main blade to an included modal?

Trying to implement a functionality where a modal is triggered on clicking a button and an array named $incident is passed through to the properties of a Vue component. What is the correct way to pass data from a parent blade to an included modal? I initia ...

Is there a way to remove a certain child category post from appearing in a parent category?

I'm having trouble with displaying related posts by category while excluding a specific category. I've tried different methods but none seem to work, and I'm not sure how else to approach this issue. <?php $categories = get_the_terms ...

Django does not support running JavaScript natively

Wondering how to incorporate JavaScript into Django for creating chained forms? My first step was simply trying to understand how to run JavaScript. I've placed a basic main.js file in the static folder. I included a link to main.js in the header of ...

The outcomes may vary even with identical fonts, character spacing, and line-height

When I first learned about @font-face in CSS3, I was excited about the prospect of using consistent fonts across all browsers. However, after experimenting with it using the code below on jsFiddle, my expectations were challenged: HTML: <div> T ...