[英]Pass arguments to afterclose callback on click of button in fancybox
在父html頁面中,當我單擊鏈接時,fancybox對話框打開,並在該fancybox中加載laravel php視圖頁面。
當我在fancybox對話框中按“使用Twitter登錄”按鈕時,我想關閉fancybox並重定向到路由(登錄/推特)
當我在fancybox對話框中按“使用facebook登錄”按鈕時,我想關閉fancybox並重定向到路由(登錄/ facebook)。
要知道要路由到哪里,我需要知道afterClose回調函數中單擊了哪個按鈕。
//parent.php
$(".myDiag").fancybox({
width : 900,
height : 600,
maxWidth :"95%",
padding : 0,
fitToView : false,
autoSize : true,
autoScale : true,
autoDimensions: true,
closeClick : false,
openEffect : 'none',
closeEffect : 'none',
afterClose : function(signupSource)
{
if(signupSource)
{
window.location = "<?php echo route('login'); ?>" + "/" + signupSource;
}
}
});
//js in Fancybox.php
$('#loginWithTwitter').click(funciton(){
parent.$.fancybox.close('twitter'); // 'twitter' is not getting sent to the afterClose callback function
});
如何將signupSource從Fancybox.php傳遞給parent.php?
將所有這些按鈕設置為“提交”按鈕,並根據與之對應的已發布var中接收到的值進行設置。
而不是關閉fancy box parent。$。fancybox.close();並使用afterClose回調..我使用target ='_ top',它自動將表單數據發布到父窗口,並在發布前關閉了fancybox。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.