【问题标题】:Open an overlay while nextpage is loading在加载下一页时打开叠加层
【发布时间】:2010-01-19 00:57:36
【问题描述】:

尝试在页面更改之前打开带有加载消息的叠加层(使用 JqueryTools),找不到如何使用我的触发器的 href 属性(我正在为多个按钮使用 .btn_menu 类)

HTML

<div class='btn_menu'>
   <a class='modalInput' rel='#loading' href="a_mailling.php"></a>
</div>

JS

$(function() {

    var triggers = $(".btn_menu a").overlay({  
    expose: { 
        color: '#000', 
        loadSpeed: 200, 
        opacity: 0.9 
    }, 

    closeOnClick: false,
    onBeforeLoad: function(){ //right ?
    window.location = //need to get href attribute of clicked trigger

    }


    });

    var buttons = $("#loading button").click(function(e) {
    var yes = buttons.index(this) === 0; 
    });

});

【问题讨论】:

    标签: javascript jquery


    【解决方案1】:

    我没有经常使用 jQuery 工具,但您可以稍微不同地构造它来缓存每个 &lt;a&gt;

    $(function(){
      $('.btn_menu a').each(function(){
        var url=this.href;
        $(this).overlay({
          //other options
          onBeforeLoad: function(){
            //do something with url
          }
        });
      });
    });
    

    【讨论】:

      猜你喜欢
      • 2021-02-17
      • 2011-10-31
      • 2021-04-04
      • 1970-01-01
      • 2013-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多