【问题标题】:How to make image scrolling effect inside other image?如何在其他图像内制作图像滚动效果?
【发布时间】:2018-03-01 12:11:37
【问题描述】:

我想做类似这样的东西,以滚动效果宣传我的网站,就像在这个page中一样

我发现来自计算机的图像只是一个图像:

网站滚动里面也是图片:

所以我的问题是,如何使其他图像在该计算机 PC 内滚动,就像在我提供的原始网站上一样,也许是一些 JS?

这和我发现的solution类似:

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);

和 CSS:

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

但是如何在PC图像中制作这个图像,并上下移动?

【问题讨论】:

    标签: javascript jquery html css scrollview


    【解决方案1】:

    这就是你所需要的。

    .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>

    【讨论】:

      【解决方案2】:

      这可能不是最好的解决方案,但我现在能想到的唯一一个:

      1)你可以编辑电脑的图片,把屏幕剪掉,让它透明。

      2) 制作 2 个 div,一个在另一个里面。

      3) 首先,较大的将包含一张电脑的图片。

      4)第二个将完全填充计算机图片中的空白空间,屏幕所在的位置。

      5) 确保在样式表中为内部 div 添加overflow: scroll;

      它看起来像:

      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;
          }
      

      现在我知道这个解决方案很难做出响应,但这是我现在能想到的唯一想法。

      【讨论】:

      • 谢谢,也会看看你的解决方案。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-09
      • 1970-01-01
      • 1970-01-01
      • 2012-01-21
      • 1970-01-01
      相关资源
      最近更新 更多