jQuery3 animate()用于旋转元素时的错误(交换高度和宽度)

时间:2017-01-10 01:07:59

标签: javascript jquery html css animation

我有一些旋转的图像,使用简单的CSS变换。

这些也是可缩放的,我尝试使用jQuery动画来简化缩放。

但是,无论何时在旋转的图像上使用动画,动画的起始帧都会交换图像的高度和宽度。

我在这里做了一个简单的小提琴,所以你可以亲自看看:https://jsfiddle.net/4ancpyuo/7/

这是一个stackoverflow版本,显示jQuery2上存在的问题:



private void sendingThreadFunction()
        {
            try
            {
                using (ECDiffieHellmanCng sendingMode = new ECDiffieHellmanCng())
                {
                    using (TextReader reader = File.OpenText("sendersReceivingPort.txt"))
                    {
                        sendersReceivingPort = int.Parse(reader.ReadLine());
                        sendersReceivingPort++;
                    }
                    using (StreamWriter sw = new StreamWriter("sendersReceivingPort.txt"))
                    {
                       sw.WriteLine(sendersReceivingPort.ToString());
                    }
                    sendingMode.KeyDerivationFunction = ECDiffieHellmanKeyDerivationFunction.Hash;
                    sendingMode.HashAlgorithm = CngAlgorithm.Sha256;
                    sendersPublicKey = sendingMode.PublicKey.ToByteArray(); 


                    IPEndPoint ipLocalEndPoint = new IPEndPoint(IPAddress.Parse(ipAddress), sendersReceivingPort);


                    sendingSendPublicKeyNotification = new TcpClient(ipLocalEndPoint);
                    sendingSendPublicKeyNotification.Connect(IPAddress.Parse(ipAddress), receiversReceivingPort);
                    NetworkStream dataStreamNotification = sendingSendPublicKeyNotification.GetStream();
                    byte[] notification = Encoding.UTF8.GetBytes("#PK");
                    dataStreamNotification.Write(notification, 0, notification.Length);
                    dataStreamNotification.Close();
                    sendingSendPublicKeyNotification.Close(); 

                    Thread.Sleep(400);

                    sendingPublicKey = new TcpClient();
                    sendingPublicKey.Connect(IPAddress.Parse(ipAddress), receiversReceivingPort);
                    NetworkStream dataStreamPublicKey = sendingPublicKey.GetStream();
                    dataStreamPublicKey.Write(sendersPublicKey, 0, sendersPublicKey.Length);
                    dataStreamPublicKey.Close();
                    sendingPublicKey.Close(); //poslje public key

                    Thread.Sleep(400);

                    sendingReceivePublicKeyListener = new TcpListener(IPAddress.Parse(ipAddress), sendersReceivingPort);
                    sendingReceivePublicKeyListener.Start();

                    sendingReceivePublicKeyNotificationClient = sendingReceivePublicKeyListener.AcceptTcpClient();
                    NetworkStream dataStreamReceivedNotification = sendingReceivePublicKeyNotificationClient.GetStream();
                    byte[] notificationReceived = new byte[3];
                    dataStreamReceivedNotification.Read(notificationReceived, 0, notificationReceived.Length);
                    dataStreamReceivedNotification.Close();
                    sendingReceivePublicKeyListener.Stop();

                    if(Encoding.UTF8.GetString(notificationReceived) != "#PK")
                    {
                        senderMode.Join();
                    } 


                    sendersListener = new TcpListener(IPAddress.Parse(ipAddress), sendersReceivingPort);
                    sendersListener.Start();

                    sendersNewClient = sendersListener.AcceptTcpClient();
                    NetworkStream dataStreamReceive = sendersNewClient.GetStream();
                    byte[] receiversPublicKey = new byte[1024];
                    dataStreamReceive.Read(receiversPublicKey, 0, receiversPublicKey.Length);
                    dataStreamReceive.Close();
                    receiversPublicKey = Decode(receiversPublicKey);
                    sendersListener.Stop(); //prejmemo prejemnikov public key


                    CngKey secretKey = CngKey.Import(receiversPublicKey, CngKeyBlobFormat.EccPublicBlob);
                    sendersKey = sendingMode.DeriveKeyMaterial(CngKey.Import(receiversPublicKey, CngKeyBlobFormat.EccPublicBlob));




                    byte[] encryptedFile = null;
                    byte[] ivFile = null;
                    byte[] fileBytes = File.ReadAllBytes(fileToSendPath);
                    Encryption(sendersKey, fileBytes, out encryptedFile, out ivFile); 

                    byte[] encryptedFD = null;
                    byte[] ivFD = null;
                    byte[] fdInformation = Encoding.UTF8.GetBytes("#FD|" + fileToSendName + "|" + encryptedFile.Length.ToString());
                    Encryption(sendersKey, fdInformation, out encryptedFD, out ivFD); // kriptira podatke o datoteki

                    sendingFD = new TcpClient();
                    sendingFD.Connect(IPAddress.Parse(ipAddress), receiversReceivingPort);
                    NetworkStream dataStreamFD = sendingFD.GetStream();
                    var mergedFDData = new byte[ivFD.Length + encryptedFD.Length];
                    ivFD.CopyTo(mergedFDData, 0);
                    encryptedFD.CopyTo(mergedFDData, ivFD.Length);
                    dataStreamFD.Write(mergedFDData, 0, mergedFDData.Length);
                    dataStreamFD.Close();
                    sendingFD.Close(); 

                    Thread.Sleep(400); 

                    sendingFile = new TcpClient();
                    sendingFile.Connect(IPAddress.Parse(ipAddress), receiversReceivingPort);
                    NetworkStream dataStreamFile = sendingFile.GetStream();
                    var mergedFileData = new byte[ivFile.Length + encryptedFile.Length];
                    ivFile.CopyTo(mergedFileData, 0);
                    encryptedFile.CopyTo(mergedFileData, ivFile.Length);
                    dataStreamFile.Write(mergedFileData, 0, mergedFileData.Length);
                    dataStreamFile.Close();
                    sendingFile.Close(); //poslje file
                }
            } catch(Exception e)
            {
                MessageBox.Show("Sender - " + e.Message);
                senderMode.Join();
            }
            senderMode.Join();
        }

var params = {
  width: 142,
  height: 48
};
$("#animatebutton").click(function() {
  $("#logo").animate(params, 1000);
});

#logo {
  transform: rotate(90deg);
  margin-top: 40px;
  width: 142px;
  height: 48px;
}




Animate按钮将Google徽标转换为当前的高度和宽度超过1秒......这意味着点击它不应该做任何事情。 但是当你在JSFiddle上点击它时,你应该看到两个属性都被交换并且恢复超过1秒。

这是动画功能中的错误吗?任何解决方法?

由于

编辑:我现在只是切换到jQuery2,在我的其他功能中没有任何问题。

0 个答案:

没有答案