views:

35

answers:

1

Trying to open an overlay (with JqueryTools) with loading message before the page changes, can't find how to use the href attribute of my trigger (i'm using a class .btn_menu for multiple button)

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; 
    });

});
+1  A: 

I haven't use jQuery tools much, but you could structure it a little differently to cache each <a>.

$(function(){
  $('.btn_menu a').each(function(){
    var url=this.href;
    $(this).overlay({
      //other options
      onBeforeLoad: function(){
        //do something with url
      }
    });
  });
});
czarchaic
thx for helping me, that's working !
Shipow
You're quite welcome :)
czarchaic