2011-03-24 4 views
0

이것은 100 % 작동하지 않는 사용자에게 도움이 될 수 있습니다.페이지 당 다중 갤러리 - 거의 작동 중

IE 등에서 테마를 찾지 못하게하려고했지만 머리에 그 테마를 넣지 만 여전히 도움이되지 않습니다.

vars/갤러리를 전환하는 버튼을 클릭해도 작동하지만 jquery.min.js에서 Object Required 오류가 발생합니다. 사실 jquery.min.js가 실제로 이상하다고 생각합니다.

<script type="text/javascript"> 
// <![CDATA[ 
var g0 = "<?php getFiles("gallery/Audience"); ?>"; 
var g1 = "<?php getFiles("gallery/Exhibition"); ?>"; 
var g2 = "<?php getFiles("gallery/registration"); ?>"; 
var g3 = "<?php getFiles("gallery/Speakers"); ?>"; 
// ]]> 


$(".galleryButton").each(function (index) { 
    $(this).click(function(){ 
     initiateGallery(eval('g'+index)); 
    }).mouseover(function() { 
     $(this).css('cursor', 'pointer'); 
     $(this).css('backgroundColor', '#002E53'); 
    }).mouseout(function(){ 
     $(this).css('backgroundColor', '#000'); 
    }); 
}); 

var initiated = 'n'; 

$(document).ready(function() { 
    initiateGallery(g3); 
}); 

function initiateGallery(galleryRef){ 
    $('#galleria').html('');  
    $('#galleria').html(galleryRef); 
    if (initiated == 'n'){ 
     Galleria.loadTheme('../Scripts/galleria.classic.min.js'); 
     initiated = 'y'; 
    } 

$('#galleria').galleria({ 
     transition: 'fade', 
     show_counter: true, 
     imageCrop: true, 
     thumbCrop: "height", 
     thumbQuality: 'auto', 
     autoplay: 3000, 
     showInfo: true, 
     easing: "galleriaOut" 
    }); 
} 
</script> 
+0

이 질문인가? – David

답변

0

테마를 전환하려면 새로운 테마를로드하면됩니다.

을 쓰기 훨씬 더 우아한 방법 :

$(function() { 

    var themes = [ 
     '<?php getFiles("gallery/Audience"); ?>', 
     '<?php getFiles("gallery/Exhibition"); ?>', 
     '<?php getFiles("gallery/registration"); ?>', 
     '<?php getFiles("gallery/Speakers"); ?>' 
    ]; 

    Galleria.loadTheme(theme[0]); 

    $('.galleryButton').click(function() { 
     var theme = themes[ $(this).index() ]; 
     Galleria.loadTheme(theme); 
    }).hover(function() { 
     $(this).css('cursor', 'pointer').css('background-color', '#002E53'); 
    }, function() { 
     $(this).css('background-color', '#000'); 
    }); 

    $('#galleria').galleria({ 
     transition: 'fade', 
     show_counter: true, 
     imageCrop: true, 
     thumbCrop: "height", 
     thumbQuality: 'auto', 
     autoplay: 3000, 
     showInfo: true, 
     easing: "galleriaOut" 
    }); 

}); 
+0

단순화 될 수 있다는 것을 알았지 만 시간이 충분하지 못했습니다. – MarkBeharrell

+0

이 문제를 읽은 후에 loadTheme 명령이 실제로 Gallerias의로드 메소드 인 경우 갤러리 스킨 js이므로이 방법이 작동하지 않을 수 있습니다. 광산과 코드가 합쳐지면 아마 잘될 것입니다. 내가하고있는 일은 새로운 요소들을 같은 요소에 로딩하는 것입니다. – MarkBeharrell

+0

왜 작동하지 않는지 모르겠다. Galleria.loadTheme()을 사용하여 테마 배열에서 새 테마를로드한다. –

관련 문제