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 7528537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:24:29+00:00 2026-05-30T04:24:29+00:00

I have built a music player which loads songs from a database in a

  • 0

I have built a music player which loads songs from a database in a random order. I would like to display track info in an info panel. Because I do not know the length of artist/track names, I would like the info to scroll with a marquee effect if it’s too big. I’m told browser implementations of the marquee tag are bad so I have got a jquery plugin to do that for me in a nice smooth way (I assume the auther knows why they’re bad and has sorted it).
So far so good.

The trouble is the marquee doesnt work out whether it is needed, so I would like to run a check to see if it is necessary (ie if the length of the text warrants it or not) before calling it.

Now I’m sure the problem here is a simple css one but I cannot for the life of me figure it out – you know when you’ve been staring at something too long…

What I am attempting to do is call the marquee on an inner div if the contents of the inner div are bigger than the outer div but no matter what I do I can’t seem to get my inner div to stretch horizontally beyond my outer div unless I set a fixed width (which isn’t very helpful since I don’t know the width of the content).

Here is my simplified HTML (wrapper contains some other stuff floated either side):

<div id="mplayerinfo_wrapper"><div id="mplayerinfo_trackinfo"><div id="ti_inner"></div></div></div>

Here is my simplified css:

    #mplayerinfo_wrapper{
    width:545px;
    height:30px;
    margin-top:32px;
    display:inline-block;
    float:left;
}

#mplayerinfo_trackinfo{
    height:30px;
    width:238px;
    display:inline-block;
    overflow:hidden;
    float:left;
}

#ti_inner{
    float:left;
    height:30px;
width:auto;
}

I am then hoping to use jquery to get the width of both elements, compare them and if inner is bigger than outer, launch the marquee like so:

var owidth=$('#mplayerinfo_trackinfo').width();
var iwidth=$('#ti_inner').width();
if(iwidth>owidth){$('#ti_inner').marquee();};

If this can’t be solved through css, is there away to get content width with jquery/javascript. Any ideas? Thanks in advance

  • 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-05-30T04:24:31+00:00Added an answer on May 30, 2026 at 4:24 am

    the ti_inner CSS needs to have

        white-space: nowrap;
    

    to prevent the div just increasing in height,

    We can then check the widths to see if a marquee is required.

    I prefer to check the scrollWidth and the offsetWidth of the outer mplayerinfo_trackinfo instead of comparing the width of the 2 separate divs, mainly so that and margins,borders or padding dont get in the way, but in this example it doesnt really matter.

    Heres a sample on JSFiddle marquee if required

    Sorry it’s in mootools but I’m new to all this web stuff myself and have not used any JQuery but from what I’ve read it should be easy to swap.

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

Sidebar

Related Questions

I would like call android Music which has in built in android device/emulator.I have
I have built an MSI that I would like to deploy, and update frequently.
I have built an application in C# that I would like to be optimized
I would like to build a music bisualiser for the iphone. I have development
I have built-in tuple which looks like (u,v) . They are generated by Networkx
I have built a Ruby on Rails application (2.3.9) which allows users to track
I would like to add buttons which allow the user to buy music on
I have built a web page which contains a Crystal Report built using the
As far as I understand, all the built-in standard apps like (email, music, calendar
i'v built a huge media player with more than 250gigs of music and still

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.