• 选取图片上对应区域


    设计给了效果图片

    要实现的效果如下

    鼠标hover在最后一个button出现一个

    方法是

    <div class="top-box">
            <div class="topimg-box">
                <img src="jbt-download/download_bg.jpg" width="100%">
            </div>
            <a href="https://itunes.apple.com/cn/app/id1069591410"><div class="lgolios-box"></div></a>
            <a href="http://dl.jianbaolife.com/jianbao/app/jianbaotong.apk"><div class="lgolandroid-box"></div></a>
            <div class="lgolimg-box">
            </div>
            <div class="downimg-box">
                <img width="100%" src="jbt-download/download_qrcode.png"> 
            </div>
         </div>
    $(function(){
        var width=$(window).width();
        var height=width*0.56;
        $('.top-box').css('height',height);
        $(window).resize(function() {
          width=$(window).width();
          height=width*0.56;
          $('.top-box').css('height',height);
          $('.top-box').css('width','100%');
        }); 
        $(".lgolimg-box").hover(function(){  
            $(".downimg-box").show();  
        },function(){  
            $(".downimg-box").hide();  
        })  
    })

    css:

    .top-box{ max-width:1920px; width:100%; overflow:hidden;}
    .lgolimg-box{max-height: 500px;height: 6%;max-width: 788px;width: 14%;margin-top: 1.5%;margin-left: 21%;margin-right: auto;position: relative;cursor: pointer;}
    .lgolandroid-box{max-height: 500px;height: 6%;max-width: 788px;width: 14%;margin-top: 1.5%;margin-left: 21%;margin-right: auto;position: relative;cursor: pointer;}
    .lgolios-box{max-height: 500px;height: 6%;max-width: 788px;width: 14%;margin-top: 27%;margin-left: 21%;margin-right: auto;position: relative;cursor: pointer;}
    .downimg-box{height: 20%;width: 7.5%;margin-top: -9%;margin-left: 35%;margin-right: auto;position: relative;z-index: 999;display: none;}

    做法是将包裹图片的div设置absolute的定位,图片的宽度设置成100%,高度根据原图片的宽高比来计算,js设置这个div的高度,

    之后使用三个div分别布局到三个按钮上面。

     也可使用map

  • 相关阅读:
    第五章 调优案例分析与实战
    第六章 类文件结构
    推送和即时通迅早写完了,,一直没更新,,期末考了。
    Node.js安装备忘录
    将MyEclipse项目导入到Eclipse中
    40个Java集合类面试题和答案(转载)
    可适配平板、手机的Web开发方式
    一次Web请求过程详解
    常见HTTP状态码
    Web前端视频播放及视频的云存储
  • 原文地址:https://www.cnblogs.com/RachelChen/p/6645885.html
Copyright © 2020-2023  润新知