2010-12-01 112 views
0

点击关闭按钮后,我该如何重定向?Jquery-ui,点击关闭按钮后重定向到某页面

$(document).ready(function() { 
    var $dialog = $('<div></div>') 
     .html('This dialog will show every time!') 
     .dialog({ 
      autoOpen: false, 
      title: 'Basic Dialog' 
     }); 

    $('#opener').click(function() { 
     $dialog.dialog('open'); 
     // prevent the default action, e.g., following a link 
     return false; 
    }); 
}); 

回答

1

您popupid你可以定义一个回调在该close事件以下方式:

$(document).ready(function() { 
    var $dialog = $('<div></div>') 
     .html('This dialog will show every time!') 
     .dialog({ 
      autoOpen: false, 
      title: 'Basic Dialog', 
      close: function(ui, event) { 
       $(this).dialog('close'); 
       // redirect over here. 
      } 
     }); 
}); 
2

使用

location.href="url"; 

,你可以得到这样的

//在bindevent下面给出

$('div#popupid').bind('dialogclose', function(event) { 
    alert('closed'); 
    location.href="new url"; 
}); 
+0

@chicagoland,你可以有一个自定义的关闭事件在jquery中声明,并做一个location.href点击。 – kobe 2010-12-01 19:52:11

相关问题