2011-08-31 48 views
1

任何人都知道如何以編程方式更改Aino Galleria插件主題,比如說...更改單選按鈕選項?以編程方式更改Aino Galleria主題

我試過this method沒有成功!

I'm以下列方式使用廣場:

<script src="@Url.Content("~/Scripts/JQuery.Galleria/1.2.5/galleria-1.2.5.min.js")" type="text/javascript"></script> 
<script type="text/javascript"> 
    var virtualPath = '@Url.Content("~/")'; 

    $(document).ready(function() { 
     Galleria.loadTheme(virtualPath + '/Scripts/jQuery.Galleria/1.2.5/themes/twelve/galleria.twelve.min.js'); 

     $("input[name='theme']").bind("click", themeSelected) 

     // Initialize Galleria 
     $('#galleria').galleria({ autoplay: false, /* true, miliseconds */ 
            thumbnails: true, /*true, false, numbers, empty */ 
            imageCrop: true, /*true, false, height, width */ 
            transition: "pulse", /*fade, fadeslide, slide, flash, pulse */ 
            trasitionSpeed: 500, 
            thumbFit: true 

     }); 

    }); 

    function themeSelected() { 
     if($(this).val() == "ca"){ 
      Galleria.loadTheme(virtualPath + '/Scripts/jQuery.Galleria/1.2.5/themes/classic/galleria.classic.min.js'); 
     } 
     else if($(this).val() == "tw"){ 
      Galleria.loadTheme(virtualPath + '/Scripts/jQuery.Galleria/1.2.5/themes/twelve/galleria.twelve.min.js'); 
     } 
    } 


</script> 
<div class="content"> 
    <h1>Galleria Twelve Theme</h1> 
    <div id="galleryOptions"> 
     <label for="classic">Classic</label><input type="radio" name="theme" id="classic" value="ca" /> 
     <label for="folio">Folio</label><input type="radio" name="theme" id="folio" value="fo" /> 
     <label for="twelve">Twelve</label><input type="radio" name="theme" id="twelve" checked="checked" value="tw"/> 
     <label for="miniml">Miniml</label><input type="radio" name="theme" id="miniml" value="mi" /> 
     <label for="fullscreen">Fullscreen</label><input type="radio" name="theme" id="fullscreen" value="fu" /> 
    </div> 

    <div id="galleria"> 
     <!-- My photo gallery --> 
     <!-- ... --> 
     <!-- ... --> 
    </div> 
</div>  

,但我打開一個不同的主題,我抓到了好幾個錯誤,爲「初始化失敗:畫廊實例已初始化」。

回答

0

首次加載環球免稅店之前,您必須首先加載主題。

這裏是你應該做的:

<!-- ADD THIS -- > 
<script src="@Url.Content("~/Scripts/JQuery.Galleria/1.2.5/theme/twelve/galleria.twelve.min.js")" type="text/javascript"></script> 
<!-- ADD THIS (end) --> 
<script src="@Url.Content("~/Scripts/JQuery.Galleria/1.2.5/galleria-1.2.5.min.js")" type="text/javascript"></script> 

$(document).ready(function() { 
    <!-- REMOVE THIS because is preloaded on top --> 
    Galleria.loadTheme(virtualPath + '/Scripts/jQuery.Galleria/1.2.5/themes/twelve/galleria.twelve.min.js'); 
    <!-- REMOVE THIS (end) --> 

    <!-- other codes goes here --> 
}); 

希望它能幫助。

相關問題