/    Sign up×
Community /Pin to ProfileBookmark

Hi,

How can I achieve the following using jQuery?

My code includes a number of container <div>s each with 2 child elements. A <b> and a <p> tag as shown below:

[CODE]
<div id=”0001″ class=”marquee”>
<b>This is a headline</b>
<p>This is the first sentence of the article text</p>
</div>
[/CODE]

The container <div>s will be a fixed width. For this example, we’ll say 700px width. The <b> will be to the left and the <p> will be to the right but will fill all the remaining space without wrapping (e.g. style overflow: hidden?. This will keep the 2 child elements on the same line as shown below:

[B]This is a headline[/B] This is the first sentence of the article text

What I need to happen is as follows:

[LIST]

  • [*]

    onMouseOver (div) a test occurs to see if the <p> tag overflows or not


  • [*]

    If it does, then it scrolls to the left behind the <b> tag.


  • [*]

    If it doesn’t then nothing happens.


  • [*]

    Once it has disappeared completely it either scrolls in from the right or fades in to it’s original position.


  • [*]

    This process must repeat as long as the mouseOver occurs.


  • [*]

    onMouseOut (div) the <p> tag returns to it’s original position.


  • [*]

    onClick will be a location.href function to hyperlink the user.


  • [/LIST]

    Please ask any questions. Your help is much appreciated.

    to post a comment
    JavaScript

    1 Comments(s)

    Copy linkTweet thisAlerts:
    @vouzamoauthorAug 13.2009 — [CODE]
    if(e.clientHeight < e.scrollHeight)
    {

    }
    [/CODE]


    This checks if an element has overflowed or not.

    All I really need is for someone to point me in the direction of an example marquee where the text can start scrolling to the left on mouseover and fades back in once it has completely disappeared with the text returning to it's original position on mouseout.
    ×

    Success!

    Help @vouzamo spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...