-1

我有一个弹出的登录表单(onclick),但是当我单击站点上的任何页面时,它会闪烁一秒钟。它是使用 wordpress 的这个插件生成的http://wordpress.org/extend/plugins/flexible-frontend-login/

http://oilfieldconference.com

要重新创建,只需加载站点并单击导航栏中的日历链接..您将看到登录表单闪烁..我在控制台中看不到任何内容..

在此处输入图像描述

相关的Javascript(我认为..取自控制台/资源):

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

 });    

});
4

2 回答 2

1

我相信我有适合您的解决方案,但它涉及编辑您正在使用的插件的类文件。我看了一下JS。这不是有问题的.. 有问题的是在 js 隐藏它之前在页面上生成有问题的 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 中隐藏。

于 2013-03-06T07:38:16.220 回答
1

由于您没有发布 javascript 或任何内容,我最好的猜测是您在 javascript 中不显示任何内容,并且它在页面加载后才会运行?也许进入你的css并让它显示none和onclick display:block?

于 2013-03-05T01:21:51.420 回答