Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #4259

Re: removing "stop" button (jquery and timer)

From RobG <rgqld@iinet.net.au>
Newsgroups comp.lang.javascript
Subject Re: removing "stop" button (jquery and timer)
Date 2011-07-17 19:44 -0700
Organization http://groups.google.com
Message-ID <18a5aabc-a0ed-4098-bdba-2e45e3d89907@j14g2000prn.googlegroups.com> (permalink)
References <c189403d-74f2-4bf0-8cc9-b799e49e9846@y13g2000prb.googlegroups.com>

Show all headers | View raw


On Jul 18, 2:08 am, justaguy <do...@yahoo.com> 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

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

removing "stop" button (jquery and timer) justaguy <donli@yahoo.com> - 2011-07-17 09:08 -0700
  Re: removing "stop" button (jquery and timer) RobG <rgqld@iinet.net.au> - 2011-07-17 19:44 -0700
    Re: removing "stop" button (jquery and timer) justaguy <lichunshen84@gmail.com> - 2011-07-17 20:45 -0700

csiph-web