script chargement GalleryView utilisant jquery provoque problème
-
02-10-2019 - |
Question
J'utilise GalleryView et lorsque la charge du script dans la tête comme celui-ci
<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>
tout fonctionne bien, mais quand je l'utilise jquery pour charger le comme ceci
$(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
});
});
});
});
});
Je reçois 404 sur les boutons de nav
http: //mydoamian/undefineddark/prev.gif
http: //mydoamian/undefineddark/next.gif
toute aide serait appréciée
La solution
j'ai pu contourner ce problème en modifiant le code à la ligne 853 en définissant le chemin thématique comme une chaîne vide premier
$('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/';
}
puis dans mon appel à GalleryView je définir nav_theme de manière appropriée
$('#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"
});
});
});
});
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow