使用jQuery加载GalleryView脚本会导致问题 [英] loading GalleryView script using jquery causes problem

查看:76
本文介绍了使用jQuery加载GalleryView脚本会导致问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用GalleryView,并在这样的头部加载脚本时

I am using GalleryView and when load the script in the head like this

    <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>

一切正常,但是当我使用jquery加载这样的东西

everything works fine but when I use jquery to load the like this

$(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
                });
            });
        });
    });
});

我在导航按钮上得到404

I get 404 on the nav buttons

http://mydoamian/undefineddark/prev.gif

http://mydoamian/undefineddark/next.gif

任何帮助将不胜感激

推荐答案

我能够通过将主题路径首先定义为空字符串来修改853行中的代码来解决此问题

I was able to get around this by modifying the code at line 853 by defining theme path as an empty string first

        $('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/';
            }

然后在我对galleryView的调用中,我适当地定义了nav_theme

then in my call to galleryView I define nav_theme appropriately

$('#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"
            });
        });
    });
});

这篇关于使用jQuery加载GalleryView脚本会导致问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆