removing "stop" button (jquery and timer)

J

justaguy

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!)...
 
R

RobG

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.
 
J

justaguy

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';

  }


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, 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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top