[removed] Zoom in on mouseover WITHOUT Jquery or plugins

前端 未结 4 949
梦如初夏
梦如初夏 2020-12-14 09:24

I\'ve looked for this everywhere for weeks, and I simply cannot find something to tell me what I\'m doing wrong or how to even proceed. The goal is to create a function simi

4条回答
  •  借酒劲吻你
    2020-12-14 10:10

    This works for me: (Here is a JSFiddle)

    #imgZoom {
        height: 300;
    }
    img#imgZoom:hover {
        position: relative;
        -webkit-transform: scale(1.5);
        -ms-transform: scale(1.5);
        -o-transform: scale(1.5);
        transform: scale(1.5);
        z-index: 1000;
    }
    

    You can also add this for a cool transition effect:

    * {
        -webkit-transition: all 0.5s ease-in-out;
        -moz-transition: all 0.5s ease-in-out;
        -ms-transition: all 0.5s ease-in-out;
        -o-transition: all 0.5s ease-in-out;
        transition: all 0.5s ease-in-out;
    }
    

    *Also, you can apply the same logic not only for images, but for divs as well.

提交回复
热议问题