removing "stop" button (jquery and timer)

Discussion in 'Javascript' started by justaguy, Jul 17, 2011.

  1. justaguy

    justaguy Guest

    Hi,

    I've inherited a piece of js code (two js files) that makes two HTML
    elements as two slides with jquery (endless loop with a stopper).

    I've decided to make it 2 loops only, easy, I set up a loop counter.
    And now I'd like to remove the "stop" label/text once it finishes the
    second/last loop, btw, this "stop" labele is automatically generated
    with jquery (version 1.2.6), getting rusty with javascripting, don't
    know how.
    Here's the URL in question, http://www.knowledgenotebook.com/

    Would appreciate your help.

    P.S.
    On a side note, I don't understand why we would need 100k js file
    (jquery, not that I have something against it) for such a simple task
    (replace an HTML element with a timer!)...
     
    justaguy, Jul 17, 2011
    #1
    1. Advertising

  2. justaguy

    RobG Guest

    On Jul 18, 2:08 am, justaguy <> wrote:
    > Hi,
    >
    > I've inherited a piece of js code (two js files) that makes two HTML
    > elements as two slides with jquery (endless loop with a stopper).
    >
    > I've decided to make it 2 loops only, easy, I set up a loop counter.
    > And now I'd like to remove the "stop" label/text once it finishes the
    > second/last loop, btw, this "stop" labele is automatically generated
    > with jquery (version 1.2.6), getting rusty with javascripting, don't
    > know how.
    > Here's the URL in question,http://www.knowledgenotebook.com/
    >
    > Would appreciate your help.


    I guess you would add:

    if (loopCnt < 3) {

    // current stuff

    } else {

    // In jQuery
    $('#slider-stopper').text('whatever');

    // or in POJS
    document.getElementById('slider-stopper').innerHTML = 'whatever';

    // or just get rid of it
    document.getElementById('slider-stopper').style.visibility =
    'hidden';

    // More robust
    var el = document.getElementById('slider-stopper');
    if (el && el.style) el.style.visibility = 'hidden';

    }


    > P.S.
    > On a side note, I don't understand why we would need 100k js file
    > (jquery, not that I have something against it) for such a simple task
    > (replace an HTML element with a timer!)...


    Yes, hard to fathom. It seems to me that the two "slides" should be
    one above the other so if scripting is disabled or not available they
    are both visible. If scripting is available, then do the cross-fade
    thing. A simple function to do that is not many lines of code.

    But such effects are annoying if the user hasn't had time to read the
    slide before it fades, it would be better to make the page static. But
    advertising types like colour and movement, it attracts the eye and
    makes the site more dynamic. A better strategy is to make the dynamic
    stuff unimportant, so you have the effect without the potential loss
    of functionality.


    --
    Rob
     
    RobG, Jul 18, 2011
    #2
    1. Advertising

  3. justaguy

    justaguy Guest

    On Jul 17, 10:44 pm, RobG <> wrote:
    > On Jul 18, 2:08 am, justaguy <> wrote:
    >
    > > Hi,

    >
    > > I've inherited a piece of js code (two js files) that makes two HTML
    > > elements as two slides with jquery (endless loop with a stopper).

    >
    > > I've decided to make it 2 loops only, easy, I set up a loop counter.
    > > And now I'd like to remove the "stop" label/text once it finishes the
    > > second/last loop, btw, this "stop" labele is automatically generated
    > > with jquery (version 1.2.6), getting rusty with javascripting, don't
    > > know how.
    > > Here's the URL in question,http://www.knowledgenotebook.com/

    >
    > > Would appreciate your help.

    >
    > I guess you would add:
    >
    >   if (loopCnt < 3) {
    >
    >     // current stuff
    >
    >   } else {
    >
    >     // In jQuery
    >     $('#slider-stopper').text('whatever');
    >
    >     // or in POJS
    >     document.getElementById('slider-stopper').innerHTML = 'whatever';
    >
    >     // or just get rid of it
    >     document.getElementById('slider-stopper').style.visibility =
    > 'hidden';
    >
    >     // More robust
    >     var el = document.getElementById('slider-stopper');
    >     if (el && el.style) el.style.visibility = 'hidden';
    >
    >   }
    >
    > > P.S.
    > > On a side note, I don't understand why we would need 100k js file
    > > (jquery, not that I have something against it) for such a simple task
    > > (replace an HTML element with a timer!)...

    >
    > Yes, hard to fathom. It seems to me that the two "slides" should be
    > one above the other so if scripting is disabled or not available they
    > are both visible. If scripting is available, then do the cross-fade
    > thing. A simple function to do that is not many lines of code.
    >
    > But such effects are annoying if the user hasn't had time to read the
    > slide before it fades, it would be better to make the page static. But
    > advertising types like colour and movement, it attracts the eye and
    > makes the site more dynamic. A better strategy is to make the dynamic
    > stuff unimportant, so you have the effect without the potential loss
    > of functionality.
    >
    > --
    > Rob


    Rob, you're a genius, thank you. I searched for key word, "stop" in
    both scripts before to no avail... definitely your sight is superior
    among others...
    today with "slider-stopper", spot on, I saw the "stop" link...
    At such low cost, I definitely go for the robust solution, it works
    perfectly with FF 3.6, IE9 and Chrome12 and Safari 5 (all on win7).

    I'm totally with you about the over-riding importance of
    functionality, however, too bad it seems that most college students
    these days associate this type of fluffy coolness with underlying
    technology and their perception of value...

    On the technical side, I also attempted to make the height of the
    second slide shorter but without success, currently they both are
    inside the "slider" container.

    Thanks again.

    Don
     
    justaguy, Jul 18, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kelsang Wangchuk

    System.Timers.Timer vs. System.Threading.Timer

    Kelsang Wangchuk, Jul 31, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    756
    Kelsang Wangchuk
    Jul 31, 2003
  2. Replies:
    1
    Views:
    1,677
    Steve C. Orr [MVP, MCSD]
    Feb 22, 2005
  3. Simon

    page timer, or redirect timer

    Simon, Nov 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    11,261
    Bruce Barker
    Nov 4, 2005
  4. Aaron Gray
    Replies:
    20
    Views:
    426
    Lasse Reichstein Nielsen
    Jul 27, 2008
  5. lorlarz
    Replies:
    6
    Views:
    231
    David Mark
    Mar 25, 2010
Loading...

Share This Page