SORU
10 Aralık 2010, Cuma


Y beklenmeyen belirteç YASADIŞI

// if the box is outside the window, move it to the end
function checkEdge() {
    var windowsLeftEdge = $('#window').position().left;

    $('.box').each( function(i, box) {
        // right edge of the sliding box
        var boxRightEdge = $(box).position().left   $(box).width();

        // position of last box   width   10px
        var newPosition = getNewPosition();

        if ( parseFloat(boxRightEdge) < parseFloat(windowsLeftEdge) ) { 
            $(box).css('left', newPosition);
            $(box).remove().appendTo('#window');
            first = $('.box:first').attr('class');
        }
    });
}​ //Uncaught SyntaxError: Unexpected token ILLEGAL Occurs Here

// arrange the boxes to be aligned in a row
function arrangeBoxes() {
    $('.box').each( function(i, item) {
        var position = $('#window').position().left   i * ( $(item).width());
        $(item).css('left', position 'px')
    });
}

// shifts all the boxes to the left, then checks if any left the window
function shiftLeft() {
    $('.box').animate({'left' : "-=100px"}, 5000, 'linear', checkEdge());
}

// returns the new location for the box that exited the window
function getNewPosition() {
    return $('.box:last').position().left   $('.box:last').outerWidth();
}

$(window).load(function() {
      arrangeBoxes();
    shiftLeft();
    setInterval('shiftLeft()', 5000);

    $('#gallery-slideshow').nivoSlider({
        effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
        slices:15,
        animSpeed:500, //Slide transition speed
        pauseTime:3000,
        startSlide:0, //Set starting Slide (0 index)
        directionNav:true, //Next & Prev
        directionNavHide:true, //Only show on hover
        controlNav:false, //1,2,3...
        keyboardNav:false, //Use left & right arrows
        pauseOnHover:false, //Stop animation while hovering
        manualAdvance:false, //Force manual transitions
        captionOpacity:0, //Universal caption opacity
        beforeChange: function(){},
        afterChange: function(){},
        slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded
    });

});

$(document).ready(function(){

    $('.class-table tr').click(function(){
        window.location=$(this).find("a").attr("href"); return false;
    });

    $('.special-workshop').click(function(){
        window.location=$(this).find("a").attr("href"); return false;
    });

});

Yakalanmamış bir SyntaxError alıyorum: satır yukarıda Beklenmedik belirteci GEÇERSİZ. Google Chrome ve Safari gösterir. Bu JSBin Firefox ve aynı kod çalışır (http://jsbin.com/uceqi/18) çalışır

Neler oluyor?

Stackoverflow bu sorun için çok sayıda başvurular var ama hiçbiri böyle bir durum için geçerli gibi görünüyor.

Eğer JSLint de atar ve o satırda hata karakter 2 yararı varsa "satır 22 karakter Sorunu 2:". " Beklenmedik

CEVAP
10 Aralık 2010, Cuma


Tüm görünmez karakterleri (boşluk) çevresinde silin, bir kez daha bakayım o zaman.

Kopyala/kod yapıştırırken Safari hata gördüm. Geçersiz (ve ne yazık ki görünmez) bazı karakterler alabilirsiniz.

JsFiddle kopyalama benim için çok büyük olurdu.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Google Analytics

    Google Analy

    25 ŞUBAT 2008
  • infodirt

    infodirt

    11 Mart 2009
  • Vsauce

    Vsauce

    30 Temmuz 2007