Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > removing "stop" button (jquery and timer)

Reply
Thread Tools

removing "stop" button (jquery and timer)

 
 
justaguy
Guest
Posts: n/a
 
      07-17-2011
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!)...
 
Reply With Quote
 
 
 
 
RobG
Guest
Posts: n/a
 
      07-18-2011
On Jul 18, 2:08*am, justaguy <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
justaguy
Guest
Posts: n/a
 
      07-18-2011
On Jul 17, 10:44*pm, RobG <(E-Mail Removed)> wrote:
> On Jul 18, 2:08*am, justaguy <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing GPO setting from XP machine after removing from Domain Piet Slaghekke Computer Support 4 01-02-2007 08:58 PM
removing a namespace prefix and removing all attributes not in that same prefix Chris Chiasson XML 6 11-14-2006 05:08 PM
How to fire both event button click and textchanged when button is click and text is changed Amy ASP .Net 0 06-01-2006 02:33 PM
In asp event occurs once for textbox.textchanged AND button.button =?Utf-8?B?U3BlbmNlciBILiBQcnVl?= ASP .Net 1 06-13-2005 10:45 PM
Removing Link from Button column PrasantH ASP .Net Datagrid Control 1 01-20-2005 11:21 AM



Advertisments