PDA

View Full Version : stepcarousel.js freeks out in ff



shanewillie
08-10-2011, 05:26 PM
1) Script Title: stepcarousel.js
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm

3) Describe problem:
when viewing http://chattanoogacares.org with firefox the carousel begins scrolling wildly out of control if the page is displayed too long. i can leave the page open, virtually forever, in ie and no problem.

help?
shane

jscheuer1
08-10-2011, 11:54 PM
How long? I tried for about 5 minutes or more, everything was fine.

Is there any sequence of events, like things I could do to accelerate and/or bring on the problem?

In any case, consider this - many scripts may behave erratically in any browser if left in an open window in the background while you do other things.

shanewillie
08-11-2011, 02:02 PM
i just held it open <5 mins and it started . . . maybe it's just my machine. if you tested it for 5 and it didn't happen i'll rest o.k. that nobody is keeping any page open for longer (except me).

thanks for testing it!
shane

jughead47
08-11-2011, 02:48 PM
I've seen the same problem with Step Carousel in firefox. The script worked fine in FF3.5. I recently updated to FF5 and I've seen the carousel go crazy. Here is what I'm seeing. This is on a stepcarousel script that has the images automatically cycling on page load.

After loading the page and staying on the page the script works fine. If you start browsing a different webpage on another tab while leaving your other site open for a long time and then come back to the stepcarousel site, the stepcarousel images will cycle through extremely fast as if it is catching up the amounts of cycles it should have made while you were browsing the different web page tab. Because after a while I see the images stop cycling fast and return to normal after a short period of time!!!!!!!!

Any help in fixing this??????????????

FYI: This seems to happen in the latest Chrome browser as well

jscheuer1
08-11-2011, 04:38 PM
Ah, well that does happen with the page linked to in the first post here. And I had mentioned that it (behaving erratically) could happen with many javascript pages left in the background.

It's a gray area, as long as it settles down, this one does, it isn't a huge problem. But I certainly can see how it could bother the page's owner and/or designer.

There might be a bug report out on it. If so, there might be advice to script authors on how to avoid it. Or some idea given on what's being done about it.

My best guess is that bug or not it's the browser cutting down on CPU requests on background pages in order to boost the performance of the foreground page. They just went a little overboard.

Ah, a quick Google brought this link:

http://support.mozilla.com/en-US/questions/843838

It mentions that with jQuery animations, which this script uses, one must avoid looping them with setTimeout and setInterval. This script uses setInterval for that purpose. So it would require what would probably be a fairly complex rewrite to avoid this problem. But at least a solution (two possible solutions actually) is given in the second response. Whether or not that would actually work would require some testing on top of said rewrite.

When I have more time though, I'll look into it, as I have one script I'm just now developing that also uses the setInterval, but even though it makes extensive use of jQuery, I don't think it uses setInterval on jQuery animations, so perhaps it will be OK.

None that I have written for Dynamic Drive, but many Dynamic Drive scripts use the setInterval and/or the setTimeout to loop jQuery animations. So this is an issue Dynamic Drive should know about.

jughead47
08-11-2011, 05:50 PM
Any suggestions on a fix to this that doesn't require a rewritten major code overhaul?

jscheuer1
08-11-2011, 06:25 PM
First I'd try updating the version of jQuery, they may have fixed this. Change:


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

to:


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

If that doesn't help, I'd look into other similar scripts. Not any on Dynamic Drive though, at least none that use jQuery.

This one looks similar:

http://cssglobe.com/post/5780/easy-slider-17-numeric-navigation-jquery-slider

And in limited testing doesn't appear to have that problem in Firefox at least.

Try out their demo page:

http://cssglobe.com/lab/easyslider1.7/01.html

Let me know if it works OK for you in those browsers.

jughead47
08-12-2011, 12:47 PM
The jquery version update had no effect for me. I guess implementing a new script will be the route for me. Thanks for the help John.

jscheuer1
08-12-2011, 02:26 PM
I feel I must amend my previous post. Some of the scripts on Dynamic Drive, well at least one (Ultimate Fade In Slideshow) that uses jQuery animations in a loop does it the right way. So I suppose others may as well. The Step Carousel doesn't though.

Upon further testing, if you revert jQuery to version 1.4.2 - the version listed on the demo page, it works fine. Version 1.4.2 had some other issues, but version 1.4.4 is OK too and doesn't have 1.4.2's problems. Even 1.5.2 seems fine. Apparently this bug starts with jQuery version 1.6.x.

jughead47
08-16-2011, 01:59 PM
Yes. I changed to the 1.4.4 version and it worked! All is well. Thanks again!