Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript错误。。为什么登录表单会闪烁一秒钟?_Javascript_Jquery_Wordpress - Fatal编程技术网

Javascript错误。。为什么登录表单会闪烁一秒钟?

Javascript错误。。为什么登录表单会闪烁一秒钟?,javascript,jquery,wordpress,Javascript,Jquery,Wordpress,我有一个登录表单,点击后会弹出,但当我点击网站上的任何页面时,它会闪烁一秒钟。它是使用wordpress的这个插件生成的 要重新创建,只需加载站点并单击导航栏中的日历链接。。您将看到登录表单flash。。我在控制台里什么也没看到 我想。。取自控制台/资源: jQuery(document).ready(function($) { // $() will work as an alias for jQuery() inside of this function // Add an empty c

我有一个登录表单,点击后会弹出,但当我点击网站上的任何页面时,它会闪烁一秒钟。它是使用wordpress的这个插件生成的

要重新创建,只需加载站点并单击导航栏中的日历链接。。您将看到登录表单flash。。我在控制台里什么也没看到

我想。。取自控制台/资源:

jQuery(document).ready(function($) {
// $() will work as an alias for jQuery() inside of this function

// Add an empty container for overlay
$(document).ready( function($) {
    $('html').prepend('<div id="ffl-mask"></div><!-- added by Flexible Frontend Login Plugin. Needed for overlay. -->');
} );

$(document).ready(function() { 

     //select all the a tag with name equal to ffl-modal
     $('a[name=ffl-modal]').click(function(e) {
         //Cancel the link behavior
         e.preventDefault();
         //Get the A tag
         var id = $(this).attr('href');

         //Get the screen height and width
         var maskHeight = $(document).height();
         var maskWidth = $(window).width();

         //Set height and width to mask to fill up the whole screen
         $('#ffl-mask').css({'width':maskWidth,'height':maskHeight});

         //transition effect    
         $('#ffl-mask').fadeIn(600);   
         $('#ffl-mask').fadeTo("fast",0.8); 

         //Get the window height and width
         var winH = $(window).height();
         var winW = $(window).width();

         //Set the popup window to center
         $(id).css('top',  winH/2-$(id).height()/2);
         $(id).css('left', winW/2-$(id).width()/2);

         //transition effect
         $(id).fadeIn(1000);

     });

     //if close button is clicked
     $('.ffl-window .ffl-close').click(function (e) {
         //Cancel the link behavior
         e.preventDefault();
         $('#ffl-mask, .ffl-window').hide();
     });    

     //if mask is clicked
     $('#ffl-mask').click(function () {
         $(this).hide();
         $('.ffl-window').hide();
     });        

});

// calculate mask when user resizes window
$(document).ready(function () {
    $(window).resize(function () {

         var box = $('#ffl-boxes .ffl-window');

         //Get the screen height and width
         var maskHeight = $(document).height();
         var maskWidth = $(window).width();

         //Set height and width to mask to fill up the whole screen
         $('#ffl-mask').css({'width':maskWidth,'height':maskHeight});

         //Get the window height and width
         var winH = $(window).height();
         var winW = $(window).width();

         //Set the popup window to center
         box.css('top',  winH/2 - box.height()/2);
         box.css('left', winW/2 - box.width()/2);

    });
});


 $(document).ready(function() {

    // find all instances of flexible-frontend-login to append individual links
    $('a[name=ffl-popup]').each(function(){
        // get the tags from link
        var id = $(this).attr('href');
        // set linked div to hidden
        $(id).hide();                   
    });

    // select a tags with name equal to ffl-popup
    $('a[name=ffl-popup]').click(function(e) {
        // cancel link behavior
        e.preventDefault();
        // get the tags from link
        var id = $(this).attr('href');
        // Set visibility
        $(id).css('display', 'block');
    });

     //if close button is clicked
     $('.ffl-close-popup-link').click(function(e) {
         //Cancel the link behavior
         e.preventDefault();
         // get parent id
         var id = $(this).parents('div:eq(0)').attr('id');
         // and hide it
        $('#'+id).hide();
      });    

 });    

});

由于您没有发布javascript或任何东西,我的最佳猜测是您正在javascript中设置DisplayNone,并且它在页面加载后才运行?也许进入你的css,让它显示无,然后点击display:block?

我相信我有一个解决方案给你,但它涉及到编辑你正在使用的插件的类文件。我看了看JS。这不是争论的焦点。。有争议的是,在js隐藏该div之前,该div正在页面上生成。要解决此问题,请执行以下操作。请注意,这是未经测试的,因为我的机器上没有安装wordpress和相关插件:

进入flexible frontend login\includes\classes\class.FrontendLogin.php并找到第49行,应该是这样的:

$html .= "<div id='ffl-popup-content-$unique' class='ffl-popup-content ffl-{$this->horizontal_position} ffl-{$this->vertical_position}'>";
替换它,或将其编辑为这样。这两种方法都有效:

$html .= "<div id='ffl-popup-content-$unique' class='ffl-popup-content ffl-{$this->horizontal_position} ffl-{$this->vertical_position}' style='display: none;'>";

此编辑将导致相关div在生成时隐藏,而不是稍后在js中隐藏。

我们需要更多信息。表单是由什么生成的。。您的模块/扩展/您正在使用的CMS。。这是我们无法访问的信息。而且,它不会为我闪烁。补充说,它的wordpress和由我们生成的也需要复制行为的步骤。。我个人无法复制它。加载主页。。。2.单击导航中的日历链接。。您应该会看到登录框弹出表单闪烁一秒钟,这应该只会在单击时触发。。谢谢