2017-06-05 3 views
0

私はjQueryUIとPolymerのポップアップダイアログを使用しています。私はdivを隠していて、ajaxからプロファイル写真のデータを読み込み、divを画像要素でポピュレートしてフェードインしています。これは、スライディングではなく、うまくフェードインする別のセクションでも同じようにしています。私は問題に影響を与えないことがわかったので、ここで多くのコードを削除しました。jQuery UIがフェードの代わりにスライドする原因は何ですか?

function supervisorAccountPopup(e) { 

    var button = e.target; 

    while (!button.hasAttribute('data-dialog') && button !== document.body) { 
     button = button.parentElement; 
    } 


    if (!button.hasAttribute('data-dialog')) { 

     return; 

    } 

    var dialogID = button.getAttribute('data-dialog'); 
    var dialog = document.getElementById(dialogID); 

    if (dialog) { 

    $('#supervisorPopupProfilePic').hide(); 


     dialog.open(); 

     $.ajax({ 
      type: 'POST', 
      url: 'getProfileImage.php', 
      data:{'userID':<? echo $createdByID; ?>, 
        'size' :'big'}, 
      tryCount:0, 
      retryLimit:5, 
      cache:false, 
      success: function(data) { 

       var profileData = JSON.parse(data); 

       if(profileData[0].profilePhotoFullpath != ""){ 

        $('#supervisorPopupProfilePic').html("<img class='profileImgPopup' id='supervisorPopupProfilePicIMG' src='uploads/profile/" + profileData[0].profilePhotoFullpath + "?" + new Date().getTime() + "'>"); 

        var supervisorPopupProfilePic = document.getElementById('supervisorPopupProfilePicIMG'); 

        supervisorPopupProfilePic.onload = function() { 
         $('#supervisorPopupProfilePic').show('fade');  
        }; 

       }else{ 

        $('#supervisorPopupProfilePic').html("<img id='supervisorPopupProfilePicIMG' class='profileImgPopup' src='uploads/profile/_default/defaultProfileImage_big_noBorder.png'>"); 

        var supervisorPopupProfilePic = document.getElementById('supervisorPopupProfilePicIMG'); 

        supervisorPopupProfilePic.onload = function() { 
         $('#supervisorPopupProfilePic').show('fade');  
        }; 

       } 


      }, 
      error : function(xhr, textStatus, errorThrown) { 

       this.tryCount++; 

       if (this.tryCount <= this.retryLimit) { 
        //try again 
        $.ajax(this); 
        return; 
       }  

       return; 

      } 
     }); 

    } 

} 

答えて

0

あなたはここにフェードオプションを使用している:$( '#supervisorPopupProfilePic')ショー( 'フェード');。

コンテンツをスライドインまたはスライドアウトするには、単一のアクションだけが必要な場合はslideToggle()またはslideDown()を使用します。あなたはshow()を必要としません。

button.click(function() { 
    $('#supervisorPopupProfilePic').slideToggle("slow", function() { 

    }); 
}); 

または

button.click(function() { 
    $('#supervisorPopupProfilePic').slideDown("slow", function() { 

    }); 
}); 
+0

いいえ、私はそれが今、スライドさ言っているが、私はそれはしたくありません。私はそれが消えたい、しかし何らかの理由でそれは滑っている。 – VagueExplanation

関連する問題