使用jquery加载GalleryView脚本会导致问题

时间:2010-09-10 20:15:36

标签: jquery galleryview

我正在使用GalleryView,当像这样加载脚本时

    <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加载这样的

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

http://mydoamian/undefineddark/prev.gif

http://mydoamian/undefineddark/next.gif

任何帮助将不胜感激

1 个答案:

答案 0 :(得分:1)

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

        $('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

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