2

ライトボックスを使ってスクロール可能なギャラリーをオンラインにする予定です。エラーが発生しました。コードの 1 つに予期しない " : " があり、次のいずれかが必要です: "}" 、" " 、 ATTR

CMS の使用をシンプルに。cmsms エラーの場合、表示されます

/xxx/xxx/public_html/lib/smarty/sysplugins/smarty_internal_templatecompilerbase.php ファイルの 702 行目

これは、私のウェブサイトに配置する予定のコードです。 http://sorgalla.com/jcarousel/

ここにエラーを投稿し、その後に完全なスクリプトを投稿します。

エラーコード。

jQuery("#gallery-prev").click(function(){
            if(jQuery("#gallery").position().left < 0 && !jQuery("#gallery").is(":animated")){
                jQuery("#gallery").animate({left : "+=" + imageWidth + "px"});
            }
            return false;
        });

完全なコード。

<script type="text/javascript">
$(window).load(function(){ 

    // Gallery
    if(jQuery("#gallery").length){

        // Fancybox
        jQuery("#gallery li a").fancybox({
            'titleShow'     : false,
            'transitionIn'  : 'elastic',
            'transitionOut' : 'elastic'
        });

        // Variables aren't use properly due to Webkit
        var totalImages = jQuery("#gallery > li").length, 
            imageWidth = jQuery("#gallery > li:first").outerWidth(true),
            totalWidth = imageWidth * totalImages,
            visibleImages = Math.round(jQuery("#gallery-wrap").width() / imageWidth),
            visibleWidth = visibleImages * imageWidth,
            stopPosition = (visibleWidth - totalWidth);

        jQuery("#gallery").width(totalWidth);

        jQuery("#gallery-prev").click(function(){
            if(jQuery("#gallery").position().left < 0 && !jQuery("#gallery").is(":animated")){
                jQuery("#gallery").animate({left : "+=" + imageWidth + "px"});
            }
            return false;
        });

        jQuery("#gallery-next").click(function(){
            if(jQuery("#gallery").position().left > stopPosition && !jQuery("#gallery").is(":animated")){
                jQuery("#gallery").animate({left : "-=" + imageWidth + "px"});
            }
            return false;
        });
    }

});
</script>

すべての助けに感謝します。ありがとう

4

2 に答える 2

8

あなたは smarty を使用しているようですが、問題は smarty が開きかっこ {} と混同されていることです。スクリプトを smarty の {literal} タグで囲むようにしてください。

{literal}
<script.....

</script>
{/literal}

また、smarty 3 を使用している場合は、"{" の後と "}" の前にスペースを追加するだけで、リテラル タグがなくても機能する可能性があります。

jQuery("#gallery").animate({ left : "+=" + imageWidth + "px" });
于 2013-01-30T12:46:27.907 に答える
0

あなたのエラーはここにあるようです:

jQuery("#gallery").animate({left : "+=" + imageWidth + "px"});

ここから、正しいシンタックスは .animate({left: imageWidth + "px"}); のようです。

元の例から何か変更しましたか? アニメーション ギャラリーに使用できる無料のカバーフロー/コンテンツ フロー ライブラリがたくさんあります。私はJavaScriptのものしか知りません。これは最近使用したもので、非常に優れていましたhttp://jacksasylum.eu/ContentFlow/

于 2013-01-30T03:08:34.387 に答える