如何在边界半径变化时停止元素移动?

时间:2015-05-05 20:44:06

标签: html css position size border

所以我刚刚获得了这个代码的小提取,我想继续添加一些更多的效果。目前,我遇到的问题是当边界半径发生变化(从0到5px)时,图像会向下跳到右边,所以不能真正得到我正在寻找的平滑过渡。这是代码:

<div id="rolloverImageWrapper">
<img src="http://oi60.tinypic.com/2ngartv.jpg" class="rolloverImages" id="rolloverImage_1"/>
</div>

.rolloverImages{
   position: absolute;
   top: 150px;
   -webkit-transition: border-radius 1s; /* Safari */
   transition: border-radius 1s;
}

#rolloverImage_1{
   margin-left: 450px;
}

#rolloverImage_1:hover{
   border:5px solid #FE9505;
   border-bottom:0px solid white;
}

.rolloverImages:hover{
   border-radius:90px;
}


#rolloverImageWrapper{

}

无论如何,提前感谢答案的人:)

1 个答案:

答案 0 :(得分:0)

正是边界导致了您所看到的问题。我能够使用初始.rolloverImage类中的填充来解决此问题,然后在悬停中删除填充。

public class SendNet: NSObject, GCDAsyncSocketDelegate {

    var socket:GCDAsyncSocket! = nil

    func setupConnection(){

            var error : NSError?
            if (socket == nil) {
                socket = GCDAsyncSocket(delegate: self, delegateQueue: dispatch_get_main_queue())
            } else {
                socket.disconnect()
            }


            if (!socket.connectToHost(host, onPort: port, withTimeout: 5.0, error: &error)){
                println("Error: \(error)")
            } else {
                println("Connecting...")
            }
    }

    public func socket(socket : GCDAsyncSocket, didConnectToHost host:String, port p:UInt16) {

       println("Connected to \(host) on port \(p).")

       self.socket = socket

       getSystemInfo()
       getSystemStatus()

    }

    func send(msgBytes: [UInt8]) {

        var msgData = NSData(bytes: msgBytes, length: msgBytes)
        socket.writeData(msgData, withTimeout: -1.0, tag: 0)
        socket.readDataWithTimeout(-1.0, tag: 0)

    }

    func getSystemInfo() {

        var sendBytes:[UInt8] = [0x0, 0x1, 0x2, 0x3]
        send(sendBytes)

    }

    func getSystemStatus() {

        var sendBytes:[UInt8] = [0x4, 0x5, 0x6, 0x7]
        send(sendBytes)

    }


    public func socket(socket : GCDAsyncSocket!, didReadData data:NSData!, withTag tag:Int){

         var msgData = NSMutableData()
         msgData.setData(data)

         var msgType:UInt16 = 0
         msgData.getBytes(&msgType, range: NSRange(location: 2,length: 1))

         println(msgType)

      }
}