How to make image scrolling effect inside other im

2019-10-17 03:08发布

i want to make something similar like this, to promote my sites in scrolling effect just like in this page

I found that image from computer is just a image:

enter image description here

and site scrolling inside is image also:

enter image description here

So my question is , how to make other image to scroll inside that computer PC, like on original site i provided, maybe some JS ?

This is similar solution i found:

HTML:

<ul id="scroller">
<li><img src="https://i.stack.imgur.com/lPcRz.jpg" width="400" 
height="1000"></li>
</ul>

JS:

    (function($) {
        $(function() { //on DOM ready
            $("#scroller").simplyScroll({
                customClass: 'vert',
                orientation: 'vertical',
                auto: true,
                manualMode: 'end',
                frameRate: 8,
                speed: 3
            });
        });
    })(jQuery);

and CSS:

/* Container DIV */
    .simply-scroll {
        width: 400px;
        height: 1000px;
        margin-bottom: 1em;
    }

but how to make this image inside PC image, and to move up and down ?

2条回答
迷人小祖宗
2楼-- · 2019-10-17 03:51

Here is what all you need.

.computer-empty {
    overflow: hidden;
    position: relative;
    width: 540px;
}
.computer-screen {
    overflow: hidden;
    position: absolute;
    height: 247px;
    width: 445px;
    left: 50px;
    top: 20px;
}
.screen-landing {
    left: 0;
    line-height: 0;
    position: absolute;
    width: 100%;
    transition: all 6s;
    -o-transition: all 6s;
    -ms-transition: all 6s;
    -moz-transition: all 6s;
    -webkit-transition: all 6s;
}
.screen-landing:hover {
    cursor: pointer;
    margin-top: -1036px;
}
img {
    max-width: 100%;
    width: auto\9;
    height: auto;
    vertical-align: middle;
    border: 0;
    -ms-interpolation-mode: bicubic;
}
.computer-empty img.computer {
    width: 100%;
}
<div class="text-align-center computer-empty">
                
                <a target="_blank" href="http://irontemplates.com/demos/redirect.php?theme=The%20Rise" class="">
                <div class="computer-screen">
                    <div class="screen-landing">
                        <img src="http://fwrd.irontemplates.com/home/img/the_rise.jpg" alt="demo - the rise">
                    </div>
                </div>
                <img class="computer" src="http://fwrd.irontemplates.com/home/img/computer.jpg" alt="computer">
                </a>
                <h1>The Rise</h1>
            </div>

查看更多
对你真心纯属浪费
3楼-- · 2019-10-17 03:55

This might not be the best solution but the only one I can think of right now:

1) You could edit the picture of computer, cut the screen off and make it transparent.

2) Make 2 divs, one inside other.

3) First, bigger one will contain a picture of computer.

4) Second one will fill exactly the empty space in picture of computer, where screen would be.

5) Make sure to add overflow: scroll; in your stylesheet for inner div.

It would look something like:

HTMl:

<div>
    <img src="path to your picture of computer">
    <div class="img-box">
        <img src="path to your picture of inside screen">
    </div>
</div>

CSS:

.img-box{
        width: ???;
        height: ???;
        overflow: scroll;
    }

Now I am aware that this solution will be hard to make responsive, but it is the only think I can think of right now.

查看更多
登录 后发表回答