2011-03-24 32 views
0

這可能有助於某人,但它不是100%的工作。多畫廊每頁 - 幾乎可以工作

我試圖通過把它們放在頭等等,但它仍然沒有真正的幫助,以阻止主題找不到錯誤與IE瀏覽器。

雖然這一切都工程單擊按鈕來切換瓦爾/畫廊現在給我一個對象所需的錯誤在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 2011-03-24 20:24:17

回答

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 2011-04-11 08:38:54

+0

這可能不工作,因爲在閱讀此問題後,問題是loadTheme命令實際上是Gallerias的加載方法是圖庫皮膚js。我和你的代碼的合併可能會做得很好......我所做的是將一組新的圖像加載到同一個元素中。 – MarkBeharrell 2011-04-11 08:52:49

+0

不明白爲什麼它不起作用,我只是使用Galleria.loadTheme()從主題數組中加載一個新主題。 – 2011-04-11 08:58:28