简体   繁体   English

单击“花式框”弹出窗口时需要弹出“花式框”

[英]Fancy box pop up required on click of fancy box popup

I have a fancy box pop up message that has a button labelled 'continue'. 我有一个花式框弹出消息,上面有一个标记为“继续”的按钮。 When I click on this button the fancy box closes. 当我单击此按钮时,花式框关闭。 What I want is this. 我想要的是这个。 I want to click on the continue button and I want the fancy box to close (as it currently does) then I want another fancy box to pop up after that (a sign in screen). 我要单击“继续”按钮,然后要关闭花式框(如当前那样),然后在此之后弹出另一个花式框(登录屏幕)。 I have code that makes the sign in screen pop up but don't know how to do this on the closing of the previous fancy box. 我有使登录屏幕弹出的代码,但是在关闭上一个花式框时不知道如何执行此操作。 I have this code for the fancy box with the continue button 我有继续按钮的花式框代码

$.fancybox({
            'content': "<div style=\"border-width: 0px; width: 350px; height: 80px; color:#00285D; font-weight:bold;\">" + message + "<br/><br/>" + "<p class=\"center\"><a href=\"#\" onclick =\"parent.$.fancybox.close();\" class=\"btn-continue\">Continue</a></p>"
        });

I have this code for popping up the sign in screen (based on a link with an id of SignIn: 我有以下代码用于弹出登录屏幕(基于ID为SignIn的链接:

<script type="text/javascript">
        $(document).ready(function () {

            CMF.pop('#SignIn',1010,459,0,0,'iframe');
        });
    </script>  

The pop method looks like this: pop方法如下所示:

// element, width, height, padding, margin, type, refresh(enabled if undefined)
    pop: function (el, w, h, p, m, i, r) {
        $(el).fancybox({
            width: w,
            height: h,
            padding: p,
            margin: m,
            type: i,
            scrolling: 'no',
            onClosed: function () {
                if( r == undefined)
                    parent.location.reload(true);                       
            }
        });
    } // fancybox

Any ideas? 有任何想法吗?

Thanks, 谢谢,

Sachin 萨钦

A demo page would help people answer your question much quicker saving both you and them time. 演示页面将帮助人们更快地回答您的问题,从而节省您和他们的时间。 But anyway.. FancyBox apparently has a lot of "automatic" features since it seems to be made to be an easy image gallery solution. 但是无论如何.. FancyBox显然具有很多“自动”功能,因为它似乎是一种简单的图库解决方案。

Instead of calling: 而不是调用:

parent.$.fancybox.close();

which doesn't even work in my example, because it existed in the current window, not window.parent so $.fancybox.close() would have been fine, if it was needed. 在我的示例中这甚至都不起作用,因为它存在于当前窗口中,而不存在于window.parent中,因此,如果需要的话,$ .fancybox.close()会很好。 you just want fancy box to auto transition to the new content so just trigger the click event like this: 您只希望精美框自动过渡到新内容,因此只需触发click事件,如下所示:

$('#SignIn').trigger('click');

be sure not to call close or it negates this click somehow...? 确保不调用close或以某种方式否定此点击...? and yes, I too think it's stupid that FancyBox doesn't have a way of trigging the pop up without making you fake a "click" on the host item... 是的,我也认为FancyBox没有一种触发弹出窗口而不假冒您对宿主项目“点击”的方式是愚蠢的……

but straight from the horse's mouth: http://fancybox.net/blog (look under #6) 但直接从马口中走出http//fancybox.net/blog (在#6下查看)

hope that helps -ck 希望对您有帮助-ck

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM