简体   繁体   English

自动放大n输出CSS(苹果般的幻灯片效果)

[英]auto zoom in n out CSS (apple-like slideshow effect)

I like pretty much the slow auto zoom in and out effect on that site : http://watchingtheworldcup.com/ for banner images such as the very top one. 我非常喜欢在该网站上缓慢的自动放大和缩小效果: http//watchingtheworldcup.com/以获取最顶级的横幅图片。 I tired to replicate it, by looking at developer tools wihtin browser, but have some trouble implementing it as in developper tool some mentions are stroked etc. 我厌倦了复制它,通过浏览器查看开发人员工具,但在开发工具中实现它有些困难,有些提及被抚摸等。

here is my html : 这是我的HTML:

 <div class="row">  
     <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
         <a href="#">
             <article class="article_container">
                 <img class="article_image_hompage5" src="#">       
                 <h2 class="article_title_hompage3"> a favourite thai soup</h2>     
             </article>
         </a>
     </div>
 </div>

and my css for the image : 和我的css图像:

.article_image_hompage5{
    width: 100%;
    border-radius: 2px 2px 2px 2px;
    position:relative;
    display:block;
    margin-left:auto;
    margin-right:auto;
    margin-top:15px;
    z-index:0;
}

Can someone help with with finding the right css settings ? 有人可以帮助找到正确的CSS设置吗? cheers, 干杯,

Use css animation you can get the similar result. 使用css动画你可以得到类似的结果。

 /* Chrome, Safari, Opera */ @-webkit-keyframes zoom { from { -webkit-transform: scale(1,1); } to { -webkit-transform: scale(1.5,1.5); } } /* Standard syntax */ @keyframes zoom { from { transform: scale(1,1); } to { transform: scale(1.5,1.5); } } img { -webkit-animation: zoom 50s; /* Chrome, Safari, Opera */ animation: zoom 50s; } 
 <img alt="" src="http://watchingtheworldcup.com/photos/worldcup1.jpg" /> 

If you want to also zoom out you need to define the the milestones in your keyframes as such: 如果您还要缩小,则需要在关键帧中定义里程碑,如下所示:

@-webkit-keyframes zoominout {
    0% {
        -webkit-transform: scale(1,1);
    }
    50% {
        -webkit-transform: scale(1.5,1.5);
    }
    100% {
        -webkit-transform: scale(1.1,1.1);
    }
}

Use css transform:scale(); 使用css transform:scale();

like: 喜欢:

JavaScript: JavaScript的:

 window.onload=function(){ $("#content").fadeOut(4000); $("#background").addClass("zoom"); setTimeout(function(){ $("#background").removeClass("zoom"); },5000); } 
 body{ margin:0px; padding:0px; width:100%; height:100%; } #background{ position:absolute; top:0px; left:0px; width:100%; height:100%; background:url("http://watchingtheworldcup.com/photos/worldcup1.jpg") center center no-repeat; background-size: 100% 100%; display:inline-block; z-index:2; transition:all ease 4.1s; /* transform:scale(1,1);*/ } #content{ position:absolute; top:0px; left:0px; width:100%; height:100%; z-index:3; background-color:rgba(0,0,0,0.5); color:#ffffff; font-size:50px; } .zoom{ transform:scale(1.2,1.2); } HTML: 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <div id="background"> </div> <div id="content"> <center><br /><br /><br /><br /><br /><br /> Watching... </center> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM