关闭按钮在倾斜模式

Close button in leanModal

本文关键字:模式 倾斜 关闭按钮      更新时间:2023-09-26

嗨,我遇到了小问题,我需要添加到我的精简模式关闭按钮图片中我已经接近了.png但我不知道如何将其添加到代码中。有什么帮助吗?

我的函数看起来像这样:

<script type="text/javascript"> $(function(){
      $('#loginform').submit(function(e){       return false;     });        
      $('#modaltrigger').leanModal({ top: 110, overlay: 0.45, closeButton: ".hidemodal" }); }); 
</script>

您需要正确设置类"hidemodal"的css才能使其工作。

在leanModal网站的例子中(通过分析源代码),你有这样一行代码:

.modal_close { position: absolute; 
               top: 12px; 
               right: 12px; 
               display: block; 
               width: 14px; 
               height: 14px; 
               background: url(../img/modal_close.png); 
               z-index: 2;}

因此,您需要按.hidemodal更改.modal_close,并根据自己的意愿调整此代码。

另一个问题是你需要在你的html代码中有一个<a class="modal_close" href="#"></a>,它不是由leanModal插件自动添加的。

通过 CSS 声明添加它

  .hidemodal {
    position: absolute;
    top: 12px;
    right: 12px;
    display: block;
    width: 14px;
    height: 14px;
    background: url(../img/close.png); <---- Add it here
    z-index: 2;
  }