caricamento di script GalleryView utilizzando jQuery causa problema
-
02-10-2019 - |
Domanda
Sto usando GalleryView e quando caricare lo script nella testa come questo
<script type="text/javascript" src="/js/galleryview/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="/js/galleryview/jquery.galleryview-2.1.js"></script>
<script type="text/javascript" src="/js/galleryview/jquery.timers-1.2.js"></script>
tutto funziona bene, ma quando uso jQuery per caricare il come questo
$(document).ready(function(){
$('#gallery').hide();
$('<link />').appendTo('head').attr({
type: 'text/css',
rel: 'stylesheet',
href: '/js/galleryview/galleryview.css'
});
$.getScript('/js/galleryview/jquery.easing.1.3.js', function() {
$.getScript('/js/galleryview/jquery.galleryview-2.1.js', function() {
$.getScript('/js/galleryview/jquery.timers-1.2.js', function() {
$('#gallery').show();
$('#gallery').galleryView({
transition_speed: 1200,
background_color: '#006',
border: 'none',
easing: 'easeInOutBack',
pause_on_hover: true
});
});
});
});
});
ottengo 404 sui tasti nav
http: //mydoamian/undefineddark/prev.gif
http: //mydoamian/undefineddark/next.gif
tutto l'aiuto sarebbe apprezzato
Soluzione
sono stato in grado di aggirare questo modificando il codice alla riga 853 definendo sentiero tematico come una stringa vuota prima
$('script').each(function(i){
var s = $(this);
theme_path = '';
if(s.attr('src') && s.attr('src').match(/jquery\.galleryview/)){
loader_path = s.attr('src').split('jquery.galleryview')[0];
theme_path = s.attr('src').split('jquery.galleryview')[0]+'themes/';
}
poi nella mia chiamata a galleryView Mi definisco nav_theme opportunamente
$('#gallery').hide();
$('<link />').appendTo('head').attr({
rel: 'stylesheet',
type: 'text/css',
href: prefix +'js/galleryview/galleryview.css'
});
$.getScript(prefix +'js/galleryview/jquery.easing.1.3.js', function() {
$.getScript(prefix +'js/galleryview/jquery.galleryview-2.1.js', function() {
$.getScript(prefix +'js/galleryview/jquery.timers-1.2.js', function() {
$('#gallery').show();
$('#gallery').galleryView({
transition_speed: 1200,
background_color: '#006',
border: 'none',
easing: 'easeInOutBack',
nav_theme:prefix +"js/galleryview/themes/dark"
});
});
});
});
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow