Page 1 of 1

Deceptively Simple, but Hard to Find Solution

Posted: Sun Oct 02, 2011 9:33 pm
by danallenvt
Simple requirement: make slideshow with nothing else on the page, on a custom webpage, that works as close to possible like the slide show at this demo I setup:
http://go-redsox.net/002_MontpelierLife ... ex_dev.php

The php running this page pulls photo urls from mysql. The problem is with the javascript, not the php, but I thought people here might have some handy solutions to this deceptively simple problem.

The problem with this photo gallery is the javascript fails intermittently in some browsers. I feel like this is a relatively common, simple requirement, but I have not found a reliable solution.

Any assistance anyone can provide will be extremely much appreciated.

Best regards,
Dan Allen
Montpelier, Vermont

Re: Deceptively Simple, but Hard to Find Solution

Posted: Sun Oct 02, 2011 9:46 pm
by egg82
By "some browsers" I assume you mean IE

"some browsers" and some browsers are not standards-compliant. Thus, you need to edit your code to accommodate them as well.
It's a pain, but it needs to be done if you want the "I know how to get on Facebook but that's it" users to be able to view your website.
Search the almighty Google and answers shall come.

More specifically, you'll need to search for the code that's giving you trouble and put "IE" at the end of it

Re: Deceptively Simple, but Hard to Find Solution

Posted: Mon Oct 03, 2011 2:23 pm
by danallenvt
egg82 wrote:By "some browsers" I assume you mean IE

"some browsers" and some browsers are not standards-compliant. Thus, you need to edit your code to accommodate them as well.
It's a pain, but it needs to be done if you want the "I know how to get on Facebook but that's it" users to be able to view your website.
Search the almighty Google and answers shall come.

More specifically, you'll need to search for the code that's giving you trouble and put "IE" at the end of it
Thanks for the reply. Problem has appeared in Chrome, Firefox, and IE at various times. It is crazy.

Isn't it kind of a scandal that something so simple is so difficult to accomplish?

Thanks again for the comments, much appreciated.

Dan

Re: Deceptively Simple, but Hard to Find Solution

Posted: Mon Oct 03, 2011 5:50 pm
by Weirdan
What exactly you mean by 'the javascript fails intermittently in some browsers.'? How do you know it fails? Do you get any errors in js console?

Re: Deceptively Simple, but Hard to Find Solution

Posted: Mon Oct 03, 2011 6:24 pm
by danallenvt
Either jQuery or Galleria occasionally display javascript errors in IE, Firefox, and Chrome, with red banner background. The problem is well known among people trying to make the Galleria photo gallery add on to jQuery work. The error will appear, then sometimes disappear after refresh. The error even has been observed on the Galleria demo page.

I have not seen the error at the link I have up now as an example, but I expect sooner or later I will, even if I never change it.

http://go-redsox.net/002_MontpelierLife ... ex_dev.php

The intermittent occurrence of this problem is part of what makes it a hassle.

What I really want is a simple solution to a simple photo gallery requirement, not using Galleria, but something else that doesn't fail at times.

For more info about Galleria failing, you can google "galleria no theme found error"

Re: Deceptively Simple, but Hard to Find Solution

Posted: Tue Oct 04, 2011 2:22 pm
by Weirdan
The code leading to this message suggests there's a timeout of 2 seconds:

Code: Select all

            // ....
            wait: function (a) {
                    var a = e.extend({
                        until: function () {
                            return !1
                        },
                        success: function () {},
                        error: function () {
                            g.raise("Could not complete wait function.")
                        },
                        timeout: 3E3
                    }, a),
                        b = f.timestamp(),
                        c, d, j = function () {
                            d = f.timestamp();
                            c = d - b;
                            if (a.until(c)) return a.success(), !1;
                            if (d >= b + a.timeout) return a.error(), !1;
                            l.setTimeout(j, 2)
                        };
                    l.setTimeout(j, 2)
                },
                // ............
      loadTheme: function(a) {
               // ....
               f.wait({
                   until: function () {
                        return c
                   },
                   error: function () {
                        g.raise("Theme at " + a + " could not load, check theme path.", !0)
                   },
                   success: function () {
                           // ....
                   },
                   timeout: 2E3
                })
               // ....
      }
If the theme is not loaded for any reason in two seconds (like if end-user has slow connection, their browser busy doing other tasks or the page the script runs on exhausted allowed number of connections to this host) you will get this error.

If you're going to use just one theme you could bundle the theme with the script itself (just add the code from the theme to the end of the script) and remove loadTheme() call from the page source entirely. This should get rid of that error permanently (and speed up page loading a bit as there will one less http request).

Re: Deceptively Simple, but Hard to Find Solution

Posted: Tue Oct 04, 2011 8:41 pm
by danallenvt
I am so in awe, I can't believe you traced through and found this. I will apply the change you suggested and let you know when it is done.

Re: Deceptively Simple, but Hard to Find Solution

Posted: Tue Oct 04, 2011 8:42 pm
by danallenvt
And thank you!