Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [jQuery]jCarousel i Firefox
Forum PHP.pl > Forum > Po stronie przeglądarki > JavaScript
Andrzejster
Witam,
zainstalowałem na swojej stronie skrypt jCarousel. Skrypt działa poprawnie na wszystkich przeglądarkach oprócz Mozilli Firefox tam przy próbie wejścia na stronę wyskakuje błąd:
Cytat
jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...

W czym może tkwić problem?
Podejrzewam, że to coś z plikiem jquery.jcarousel.js, ale z kodowaniem w JS jest u mnie cieńko więc nie wiem co jest przyczyną problemu.

Myślę, że to może mieć związek z tym fragmentem kodu:
Kod
/**
         * Prepares the carousel and return the position for a certian index.
         *
         * @name pos
         * @type Number
         * @param Number i The index of the element to scoll to.
         * @cat Plugins/jCarousel
         */
        pos: function(i) {
            if (this.locked || this.animating)
                return;

            if (this.options.wrap != 'circular')
                i = i < 1 ? 1 : (this.options.size && i > this.options.size ? this.options.size : i);

            var back = this.first > i;
            var pos  = $jc.intval(this.list.css(this.lt));

            // Create placeholders, new list width/height
            // and new list position
            var f = this.options.wrap != 'circular' && this.first <= 1 ? 1 : this.first;
            var c = back ? this.get(f) : this.get(this.last);
            var j = back ? f : f - 1;
            var e = null, l = 0, p = false, d = 0;

            while (back ? --j >= i : ++j < i) {
                e = this.get(j);
                p = !e.length;
                if (e.length == 0) {
                    e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
                    c[back ? 'before' : 'after' ](e);
                }

                c = e;
                d = this.dimension(e);

                if (p)
                    l += d;

                if (this.first != null && (this.options.wrap == 'circular' || (j >= 1 && (this.options.size == null || j <= this.options.size))))
                    pos = back ? pos + d : pos - d;
            }

            // Calculate visible items
            var clipping = this.clipping();
            var cache = [];
            var visible = 0, j = i, v = 0;
            var c = this.get(i - 1);

            while (++visible) {
                e = this.get(j);
                p = !e.length;
                if (e.length == 0) {
                    e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
                    // This should only happen on a next scroll
                    c.length == 0 ? this.list.prepend(e) : c[back ? 'before' : 'after' ](e);
                }

                c = e;
                var d = this.dimension(e);
                if (d == 0) {
                    alert('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');
                    return 0;
                }

                if (this.options.wrap != 'circular' && this.options.size !== null && j > this.options.size)
                    cache.push(e);
                else if (p)
                    l += d;

                v += d;

                if (v >= clipping)
                    break;

                j++;
            }

             // Remove out-of-range placeholders
            for (var x = 0; x < cache.length; x++)
                cache[x].remove();

            // Resize list
            if (l > 0) {
                this.list.css(this.wh, this.dimension(this.list) + l + 'px');

                if (back) {
                    pos -= l;
                    this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l + 'px');
                }
            }

            // Calculate first and last item
            var last = i + visible - 1;
            if (this.options.wrap != 'circular' && this.options.size && last > this.options.size)
                last = this.options.size;

            if (j > last) {
                visible = 0, j = last, v = 0;
                while (++visible) {
                    var e = this.get(j--);
                    if (!e.length)
                        break;
                    v += this.dimension(e);
                    if (v >= clipping)
                        break;
                }
            }

            var first = last - visible + 1;
            if (this.options.wrap != 'circular' && first < 1)
                first = 1;

            if (this.inTail && back) {
                pos += this.tail;
                this.inTail = false;
            }

            this.tail = null;
            if (this.options.wrap != 'circular' && last == this.options.size && (last - visible + 1) >= 1) {
                var m = $jc.margin(this.get(last), !this.options.vertical ? 'marginRight' : 'marginBottom');
                if ((v - m) > clipping)
                    this.tail = v - clipping - m;
            }

            // Adjust position
            while (i-- > first)
                pos += this.dimension(this.get(i));

            // Save visible item range
            this.prevFirst = this.first;
            this.prevLast  = this.last;
            this.first     = first;
            this.last      = last;

            return pos;
        },
erix
Ustaw stylami wysokość/szerokość tego kontenera.
Andrzejster
Ustawiłem szerokość, ale nadal na Firefoxie pojawia się ten błąd, znaczy pojawia się biała, ciągle ładująca się strona. To jest mój plik ze stylami. Może coś źle tam wstawiam?

Kod
/**
* This <div> element is wrapped by jCarousel around the list
* and has the classname "jcarousel-container".
*/
.jcarousel-container {
    position: relative;
    width: 475px;
    height: 80px;
}

.jcarousel-clip {
    z-index: 2;
    padding: 0;
    margin: 0;
    overflow: hidden;
    position: relative;
}

.jcarousel-list {
    z-index: 1;
    overflow: hidden;
    position: relative;
    top: 0;
    left: 0;
    margin: 0;
    padding: 0;
}

.jcarousel-list li,
.jcarousel-item {
    float: left;
    list-style: none;
    /* We set the width/height explicitly. No width/height causes infinite loops. */
    width: 475px;
    height: 80px;
}

/**
* The buttons are added dynamically by jCarousel before
* the <ul> list (inside the <div> described above) and
* have the classnames "jcarousel-next" and "jcarousel-prev".
*/
.jcarousel-next {
    z-index: 3;
    display: none;
}

.jcarousel-prev {
    z-index: 3;
    display: none;
}


erix
Lepiej wystaw gdzieś to na żywo.
Andrzejster
Całość możesz zobaczyć u mnie na stronie po zalogowaniu. Dane podeśle ci na PW.
erix
Nie podsyłaj żadnych danych. Użytkownicy, to nie helpdesk; kto inny może próbować pomóc.

To TOBIE ma zależeć na rozwiązaniu problemu.

Temat: [JavaScript] jesli Twoj watek go dotyczy, KONIECZNIE przeczytaj
Andrzejster
OK nie zauważyłem tamtego tematu. Już się zapoznałem.
Skrypt można zobaczyć online tutaj po zalogowaniu:

http://e-fusion.orge.pl
nick: Moderator
hasło: 123456

Panel ze skryptem znajduje się na dole strony głównej i nosi nazwę Ostatnio online.
Jeśli to nie starczy zamieszczam pliki tego skryptu http://e-fusion.orge.pl/projekty_panel.rar
Skrypt działa z CMS'em eXtreme-Fusion IV lub PHP-Fusion 6.
erix
Doprowadź lepiej całość do porządku...
Cytat
Error: $("bezel") is null
Source File: http://e-fusion.orge.pl/infusions/shoutbox_panel/js/growl.js
Line: 132

Cytat
Error: XMLHttpRequest is not defined
Source File: http://e-fusion.orge.pl/includes/jquery-1.4.2.min.js
Line: 2692


Jak to zobaczyłem, odechciało mi się sprawdzać...
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.