将jquery脚本1.4.2升级到1.4.3

时间:2014-08-16 14:22:20

标签: jquery conflict jquery-1.4 conflicting-libraries

首先,抱歉我的英文^^,

我为我的网站使用了一个模板(http://www.templatesbook.com/jd-portfolio-template/),模板使用了jquery 1.4.2。我的网站链接(www.shoot-n-cry.com)

我还买了“全宽音频播放器”(http://codecanyon.net/item/fullwidth-audio-player-jquery-plugin/841563) 这个audioplayer适用于jquery 1.4.3和最新版但不适用于1.4.2

如果我使用jquery 1.4.3,我的项目无法打开。

我认为冲突就在这个剧本上:

// FADE EFFECT

$(document).ready(function() {    

    $('#btn_top').click(function() {
        $('html,body').animate({scrollTop: $("#container").offset().top},'slow');
    });

    $('.prjGrid .hover').hover(function () {
        $(this).stop().animate({ opacity: 1 }, 200);},
                               function () {
                                   $(this).stop().animate({ opacity: 0 }, 200);}
                              );

    $('.pprj .hover').hover(function () {
        $(this).stop().animate({ opacity: 1 }, 200);},
                            function () {
                                $(this).stop().animate({ opacity: 0 }, 200);}
                           );

    $('div#navbar li a').hover(function () {
        var is_id = '#' + $(this).attr('id') + ' .m_r';
        var is_id_w = '#' + $(this).attr('id') + ' .m_w';

        $(is_id).stop().animate( {width: $(is_id_w).width() }, 200, function(){});
    }, function () {
        is_id = '#' + $(this).attr('id') + ' .m_r';        
        $(is_id).stop().animate( {width: 0 }, 200, function(){});
    });
    var message = $( "#logo" );
    var originalMessageTop = message.offset().top;
    var view = $( window );
    view.bind(
        "scroll resize",
        function(){
            var viewTop = view.scrollTop();
            if (
                (viewTop > originalMessageTop) &&
                    !message.is( ".site-message-fixed" )
            ){
                message
                    .removeClass( "site-message-absolute" )
                    .addClass( "site-message-fixed" ).stop().animate({ opacity:  1 }, 300);
            } else if (
                (viewTop <= originalMessageTop) &&
                    message.is( ".site-message-fixed" )
            ){
                message
                    .removeClass( "site-message-fixed" )
                    .addClass( "site-message-absolute" ).stop().animate({ opacity:  0 }, 100)
                ;}
        }
    );

//高度动画效果

    $('.prjGrid .item').click(function() {
        var id_item = this.id;

        var id = '#i' + this.id;

        $('.next_slide').fadeIn('slow', function() {});
        $('.prev_slide').fadeIn('slow', function() {});

        var ids = '';
        var this_id = '';

        $('html,body').animate({scrollTop: $("#work").offset().top},'slow');


        $('#project .selected').animate({
            height: 0
        }, 600, function() {});
        $('#project .selected').css("display", 'none');         
        $('#project .selected').removeClass('selected');
        $(id).addClass("selected");

        $(id).stop().animate({
            height: 482
        }, 600, function() {
            $('#project .close_item_info').click(function() {
                $(id).removeClass("selected");
                $(id).stop().animate({
                    height: 0
                }, 600, function() {});
            }); 
        });

        $('#project').stop().animate({
            opacity: 1,
            height: 482
        }, 600, function() {
            $('.prjGrid .hover').stop().animate({ opacity: 0.5 }, 400);
            $('.prjGrid .hover').hover(function () {
                $(this).stop().animate({ opacity: 1 }, 200);},
                                       function () {
                                           $(this).stop().animate({ opacity: 0.5 }, 200);}
                                      );
            $('#project .close_item_info').click(function() {
                $('#project').stop().animate({
                    opacity: 0,
                    height: 0
                }, 600, function() {
                    $('.prjGrid .hover').stop().animate({ opacity: 0 }, 400);
                    $('.prjGrid .hover').hover(function () {
                        $(this).stop().animate({ opacity: 1 }, 200);},
                                               function () {
                                                   $(this).stop().animate({ opacity: 0 }, 200);}
                                              );
                    $(id + ' .next_slide').fadeOut('slow', function() {});
                    $(id + ' .prev_slide').fadeOut('slow', function() {});  
                });
            });
        });
    });

    $('.next_slide').click(function(event) {
        $('#project').find('.prjinfo').each(function(){
            if($(this).attr("class") == "prjinfo selected") {
                ids = $(this).attr('id');
                this_id = '#' + ids + ' .pic';
                event.preventDefault();
                var currli = $(this_id + ":visible");
                var nextli = currli.next();
                if (nextli.length == 0) {
                    nextli = currli.siblings(':first');
                }
                currli.fadeOut('fast', function() {nextli.fadeIn('fast', function() {});});
                this_id = '';
            };
        });
    });
    $('.prev_slide').click(function(event) { 
        $('#project').find('.prjinfo').each(function(){
            if($(this).attr("class") == "prjinfo selected") {
                ids = $(this).attr('id');
                this_id = '#' + ids + ' .pic';

                event.preventDefault();
                var currli = $(this_id + ":visible");
                var prevli = currli.prev();
                if (prevli.length == 0) {
                    prevli = currli.siblings(':last');
                }
                currli.fadeOut('fast', function() {prevli.fadeIn('fast', function() {});});

                this_id = '';
            };
        });
    });     


});

0 个答案:

没有答案