Scroll full image inside div

后端 未结 4 1327
难免孤独
难免孤独 2021-01-29 04:11

I have this image appended to a div JSFiddle and my Div is inside a modal. I\'v tried to display by default the bottom left quarter (like filling the div) and to allow the user

4条回答
  •  孤独总比滥情好
    2021-01-29 04:59

    Try this: (Assumption - You will adjust for your image size and containing div size as required)

    html

    JS:

    var d = $('#myDiv');
    d.scrollTop(d.prop("scrollHeight"));
    

    CSS:

    .img-wrapper {
        height: 400px;
        background-color: blue;
        position: relative;
        overflow-x:auto;
        overflow-y:auto;
    }
    
    .img-wrapper > img {
        display: inline-block;
        position: relative;
        border:1px solid red
    }
    

提交回复
热议问题