-1

当我将所有代码放在此处时,我的 jquery 代码的最后一部分不起作用。它的一个工作。我相信这个问题是因为 jquery 冲突。有谁知道如何克服这个问题?jquery的最后一部分是一个动画切换

请看演示http://jsfiddle.net/uyWNH/1/

        /*  charts TABS (WORKING)
    ===================================================================*/

    $(".chart-tabs a").click(function(e){
        e.preventDefault();
        idTab = $(this).attr("href");
        $(".chart-tabs .active").removeClass('active');
        $(this).addClass('active');
        $(idTab).siblings().stop().fadeOut(100, function(){
            setTimeout(function(){
                $(idTab).fadeIn(100);
            }, 100)
        })
        // $(idTab).show().siblings().hide();
    })


        /*  SEARCH GENDER (WORKING)
    ===================================================================*/

       $().ready(function(){

        $(".inp-radio").iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green'
        });

        $(".wrap-icon-ratio").click(function(){
           $(this).find("ins").click();
        })

        $(".wrap-icon-ratio ins").click(function(){
            $(".wrap-icon-ratio.active").removeClass("active");
            $(this).parent().parent().parent().addClass("active");
        });

    })

       /*   FOLLOW POP UP (WORKING)
===================================================================*/
$('.social-popup-btn').hover(function()
{
     if($('.social-name-popup').is(':visible'))
        $('.social-name-popup').fadeOut(750 /* Animation Time */, function()
     {
        // animation complete callback
         $('#cat').fadeIn(750);
     });
}, function()
{
     // Mouse Leave callback
});


        /*  SHOWS CHART SEARCH (NOT WORKING)
    ===================================================================*/
$(function(){
    $('.search-charts-go').click(function (e) {
    e.stopPropagation();
    if($('.search-container-wrap').hasClass('visible')) {
        $('.search-container-wrap').stop().animate({
            'width' : '0'
        }, 1000, function(){
            $(this).removeClass('visible')
        });
    } else {
        $('.search-container-wrap').addClass('visible').stop().animate({
            'width' : '400'
        }, 1000);
    }
   });
});
4

1 回答 1

0

不需要重复

$(function(){
});

将此用于非工作部分:

       /*  SHOWS CHART SEARCH
    ===================================================================*/
    $('.search-charts-go').click(function (e) {
    e.stopPropagation();
    if($('.search-container-wrap').hasClass('visible')) {
        $('.search-container-wrap').stop().animate({
            'width' : '0'
        }, 1000, function(){
            $(this).removeClass('visible')
        });
    } else {
        $('.search-container-wrap').addClass('visible').stop().animate({
            'width' : '400'
        }, 1000);
    }
   });
于 2013-09-20T15:18:16.663 回答