>

js完成收货地址弹框选拔然后回到相应的地点新闻

- 编辑:www.bifa688.com -

js完成收货地址弹框选拔然后回到相应的地点新闻

效果图:

先给大家浮现下效果图:

世家都见过某网页中的恶意广告,你关闭了又出去了!为什么,JS来告诉你

必发88官网 1

必发88官网 2
必发88官网 3
必发88官网 4

HTML

图(1)初始图

必发88官网,中央代码如下所示:

<body>
  <h3 class="whiteColor">无法关闭的弹框,打不死的小强!</h3>
  <div id="middleBox">
    <a href="javascript:;" class="close_btn" id="closeBtn"><img src="images/close_icon.png" alt="必发88官网 5" class="will_close"></a>
    <ul class="parent_btn">
      <li><a href="/" class="btn_tel"><img src="images/icon_tel.gif" alt="必发88官网 6">拨打电话</a></li>
      <li><a href="/" class="btn_chat"><img src="images/icon_chat.gif" alt="必发88官网 7">快速留言</a></li>
    </ul>
  </div>
</body>

必发88官网 8

(‘.selectaddress').click(function () {//图一联系方式中的点击事件 
    top.layer.open({ 
      id: “layer_say_hello”, 
      type: 2, 
      title: ‘请点击选择联系地址', 
      shadeClose: true, 
      shade: 0.8, 
      area: [‘300px', ‘400px'], 
      content: “{:Url(‘/mobile/user/address_list')}”, //iframe的url 
      success: function (layero, index) { 
//        var jquerySendHelloButton =(“.addre span”, layero.find(“iframe”)[0].contentWindow.document); 
var jquerySendHelloButton = (“.listdetail”,layero.find(“iframe”)[0].contentWindow.document);(jquerySendHelloButton).click(function () { 
var addressid = (this).find(‘.addressId′).val();varconsignee=(this).find(‘.contact span').eq(0).text(); 
var phone = (this).find(‘.contactspan′).eq(1).text();varaddre=(this).find(‘.addre span').text(); 
(‘.contactspan′).eq(0).text(consignee);(‘.contact span').eq(1).text(phone); 
(‘.addrespan′).eq(0).text(addre);(‘input[name=address_id]').val(addressid); 
(‘.selec′).css(‘display′,′none′);(‘.demand_add').css(‘display','block'); 
layer.close(index); 
})
      //传入参数,并赋值给iframe的元素
    }
  });
})

CSS

图(2)点击“从左边划出”

如上所述是小编给大家介绍的基于layer.js完成收货地址弹框采取然后再次来到相应的地方新闻,希望对大家具有协理,如若大家有此外疑问请给自个儿留言,作者会及时过来大家的。在此也特别谢谢我们对台本之家网站的扶助!

*{
  margin: 0;
  padding: 0;
  list-style: none;
  outline: none;
  box-sizing: border-box;
  text-decoration: none;
}
a { -webkit-touch-callout: none; text-decoration: none }
:focus { outline: 0 }
body{
  font-family: Helvetica, STHeiTi, "Microsoft YaHei", sans-serif;
  color: #595757;
  background-color: #fff;
  outline: 0;
  overflow-x: hidden;
  -webkit-tap-highlight-color:rgba(0,0,0,0);
}
img{
  border: none;
}
.whiteColor{
  color: #fff;
  text-align: center;
}
.flex_parent{
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
}
.flex_child{
  -webkit-box-flex: 1;
  -moz-box-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
}
/*middle_box*/
body{
  position: relative;
  background-color: #272822;
}
#middleBox{
  width: 260px;
  height: 248px;
  margin: 0 auto;
  background-image: url(../images/irfa_dog.jpg);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  border-radius: 10px;
  /*水平垂直居中*/
  position: fixed;
  left: 50%;
  top: 50%;
  margin-top: -124px;
  -webkit-transform: translateX(-50%);
  -moz-transform: translateX(-50%);
  -o-transform: translateX(-50%);
  -ms-transform: translateX(-50%);
  transform: translateX(-50%);
  z-index: 100;
}
.close_btn{
  display: block;
  overflow: hidden;
  position: absolute;
  top: -10px;
  right: -10px;
}
.will_close{
  width:32px;
}
#middleBox a{
  overflow: hidden;
}
#middleBox a img,#middleBox a span,#middleBox ul li{
  float: left;
}
#middleBox a span{
  font-size: 16px;
  color: #fff;
}
#middleBox ul{
  overflow: hidden;
}
#middleBox ul li{
  width: 130px;
}
#middleBox ul li a{
  line-height: 50px;
  display: block;
  padding-left: 5px;
}
#middleBox ul li a img{
  width:30px;
  margin-right: 2px;
  margin-top: 8px;
  margin-left: 5px;
}
.btn_tel{
  background-color: #F92665;
  border-bottom-left-radius: 10px;
}
.btn_chat{
  background-color: #1EA362;
  border-bottom-right-radius: 10px;
}
.parent_btn{
  position: absolute;
  left: 0;
  bottom: 0;
}

代码如下:

您或然感兴趣的小说:

  • js实现上下左右弹框划出职能
  • struts json 类型非凡重临到js弹框难点化解办法
  • javascript落实无法关闭的弹框
  • 自在完毕js弹框展现选项
  • Bootstrap和Angularjs合作自制弹框的实例代码
  • js自定义弹框插件的包装

JS

<!DOCTYPE html>
<html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
 <title>上下左右弹框划出效果</title>
 <style>
   /*css document*/
body,div,ol,ul,li,dl,dt,dd,h1,h2,h3,h4,h5,h6,p,form,fieldset,legend,input,button,aside{ padding: 0; margin: 0; -webkit-tap-highlight-color:rgba(255,255,255,0);}
   body { font-family: "Microsoft YaHei"; }
   .btn button {
 display: block;
 width: 240px; 
 line-height: 30px;
 margin: 20px auto;
 background-color: #cd0000;
 color: #fff;
 text-align: center;
 outline: none;
 border: none;
 cursor: pointer;
 font-family: "Microsoft YaHei";
}
.aside,
.aside-overlay {
 position: fixed;
 top: 0;
 right: 0;
 left: 0;
 bottom: 0;
}
.aside {
 -webkit-transition: visibility .25s;
 transition: visibility .25s;
 z-index: 3;
 visibility: hidden;
 overflow: hidden;
}
.aside > div { text-align: center; }
.aside.active {
 -webkit-transition: none;
 transition: none;
 visibility: visible;
}
.aside-overlay {
 background-color: rgb(0,0,0);
 opacity: 0;
 -webkit-transition: opacity .25s;
 transition: opacity .25s;
}
.active > .aside-overlay {
 opacity: .6;
}
.rightContent {
 position: absolute;
 bottom: 0;
 right: 0;
 top: 0;
 left: 40px;
 background:#fff;
 -webkit-transition: transform .15s;
 transition: transform .15s;
 -webkit-transform:translateX(100%); 
 transform:translateX(100%); 
}
.active > .rightContent {
 -webkit-transform:translateX(0%); 
 transform:translateX(0%); 
}
.leftContent {
 position: absolute;
 bottom: 0;
 right: 40px;
 top: 0;
 left: 0;
 background:#fff;
 -webkit-transition: transform .15s;
 transition: transform .15s;
 -webkit-transform:translateX(-100%); 
 transform:translateX(-100%); 
}
.active > .leftContent {
 -webkit-transform:translateX(0%); 
 transform:translateX(0%); 
}
.topContent {
 position: absolute;
 bottom: 40px;
 right: 40px;
 top: 0;
 left: 40px;
 background:#fff;
 -webkit-transition: transform .15s,top .15s;
 transition: transform .15s;
 -webkit-transform:translateY(-100%); 
 transform:translateY(-100%); 
}
.active > .topContent {
 top: 40px;
 -webkit-transform:translateY(0%); 
 transform:translateY(0%); 
}
.botContent {
 position: absolute;
 bottom: 0;
 right: 40px;
 top: 40px;
 left: 40px;
 background:#fff;
 -webkit-transition: transform .15s,bottom .15s;
 transition: transform .15s;
 -webkit-transform:translateY(100%); 
 transform:translateY(100%); 
}
.active > .botContent {
 bottom: 40px;
 -webkit-transform:translateY(0%); 
 transform:translateY(0%); 
}
  </style>
 </head>
 <body>
 <!-- 按钮 -->
 <div class="btn">
 <button id="rightBtn">从右侧划出</button>
 <button id="leftBtn">从左侧划出</button>
 <button id="topBtn">从上面划下</button>
 <button id="botBtn">从下面划上</button>
 </div>
 <!-- 弹出层 -->
 <aside id="aside" class="aside">
 <i class="aside-overlay hideAside"></i>
 <div class="rightContent">
 右侧划出
 </div>
 <div class="leftContent">
 左侧划出
 </div>
 <div class="topContent">
 从上面划下
 </div>
 <div class="botContent">
 从上面划下
 </div>
 </aside>
 <script type="text/javascript" src="http://www.qjdongsheng.com/uploads/allimg/190619/2252524550-5.jpg"></script>
 <script type="text/javascript">
 $(function(){
 var rightBtn = $('#rightBtn'),leftBtn = $('#leftBtn'),topBtn = $('#topBtn'),botBtn = $('#botBtn');
 var oAside = $('#aside');
 rightBtn.on("click",function(){
 $('.leftContent').hide();
 $('.topContent').hide();
 $('.botContent').hide();
 $('.rightContent').show();
 oAside.addClass('active');
 });
 leftBtn.on("click",function(){
 $('.rightContent').hide();
 $('.topContent').hide();
 $('.botContent').hide();
 $('.leftContent').show();
 oAside.addClass('active');
 });
 topBtn.on("click",function(){
 $('.rightContent').hide();
 $('.leftContent').hide();
 $('.botContent').hide();
 $('.topContent').show();
 oAside.addClass('active');
 });
 botBtn.on("click",function(){
 $('.rightContent').hide();
 $('.leftContent').hide();
 $('.topContent').hide();
 $('.botContent').show();
 oAside.addClass('active');
 });
 $('.hideAside').on("click",function(){
 oAside.removeClass('active');
 });
 })
 </script>
 </body>
</html>
/**
 * Created by Administrator on 2016/7/19.
 */
var adv={
  div:null,
  timer:null,
  btn:null,
  init:function(){
    this.btn=document.getElementById("closeBtn");
    this.div=document.getElementById("middleBox");
    this.btn.onclick=this.displayNone;
  },
  displayBlock:function(){
    adv.div.style.display="block";
  },
  displayNone:function(){
    adv.div.style.display="none";
    timer=setTimeout(function(){
      adv.displayBlock();
    },3000);
  }
};
window.onload=function(){
  adv.init();
};

如上就是本文的全部内容,希望本文的开始和结果对大家的上学可能专门的学问能带动一定的支持,同一时候也冀望多多援助脚本之家!

如上即是本文的全部内容,希望对大家持有协助,同时也指望多多帮忙脚本之家!

你只怕感兴趣的小说:

  • 基于layer.js完结收货地址弹框选拔然后回去相应的地方音讯
  • struts json 类型非凡重返到js弹框难点解决办法
  • javascript落到实处不能够关闭的弹框
  • 自在完毕js弹框展现选项
  • Bootstrap和Angularjs合营自制弹框的实例代码
  • js自定义弹框插件的卷入

你或然感兴趣的稿子:

  • 基于layer.js完毕收货地址弹框选用然后归来相应的地址消息
  • js完毕内外左右弹框划出功能
  • struts json 类型相当重临到js弹框难点化解办法
  • 轻便完毕js弹框展现选项
  • Bootstrap和Angularjs合营自制弹框的实例代码
  • js自定义弹框插件的包装

本文由必发88官网发布,转载请注明来源:js完成收货地址弹框选拔然后回到相应的地点新闻