Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8436899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:18:18+00:00 2026-06-10T07:18:18+00:00

I want to highlight a span by specific time with jquery. for example:(highlight this

  • 0

I want to highlight a span by specific time with jquery.

for example:(highlight this line in 20 sec)

<span> highlight me slowly by specific time</span>

window.setTimeout(function() {
    // what do i must write here?
}, 20*1000);

I want this Result:

http://8pic.ir/images/sk9q76r96e3dc1rq4zo.swf

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:18:19+00:00Added an answer on June 10, 2026 at 7:18 am

    EDIT

    Have a look at this latest JS fiddle, I’ve changed the code to make sure it preserves the location of the span and also turned it into a plugin
    http://jsfiddle.net/joevallender/9UgEF/4/

    Original post

    Here is some sample code to get you started, you can see it in a jsfiddle here http://jsfiddle.net/joevallender/9UgEF/2/

    HTML

    <span id="test">Do you see any Teletubbies in here?</span>​
    

    JS

    $(document).ready(function(){
    
      var seconds = 5;
      var el = $('span#test');
      var width = el.outerWidth();
      var height = el.outerHeight();
      var wrapper = $('<div>').css({
        width: width + 'px',
        height: height + 'px',
        position: 'relative'
      });
      var background = $('<div>').css({
        width: 0,
        height: height + 'px',
        position: 'absolute',
        background: '#0f0'
      });
      wrapper.append(background);
      wrapper.append(el.css('position','absolute'));
      $('body').append(wrapper);
      background.animate({width: '+=' + width},1000*seconds);
    
    });​
    

    It looks liks quite a lot of code something simple, but it was the easiest way I could think to more closely mimic your demo. If you were going to use this a lot it could be turned into a jQuery plugin relatively easily – but you might want to alter my nesting slightly, perhaps giving the wrapper div #wrapper-[span ID] or something for later use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this code to highlight my span tag by a specific time HTML:
I want to highlight a <span> using jQuery.effect('highlight'), but it fades out after a
I have a javascript loop and want to highlight some numbers for(i=0;i<=100;i++){ $(#mydiv).append(<span>+i+</span>); }
I am using jquery datepicker for my application. I want to highlight the dates
Easy question, it is valid to have overlapping spans in html? Example: <span id=1>This
Part 1: I want the .highlight() function to be active only when the input
I have this html right now: <h1><span class = 'highlight'><input type='image' class='removeall' src='remove.png'> <input
I'm using this function from here , which is: // highlight search keywords function
I made this code with jquery autocomplete its just like facebook search function now
I have a string like this: This <span class=highlight>is</span> a very nice day! What

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.