du21064 2015-08-14 12:51
浏览 141
已采纳

使用javascript制作灯箱

I have a lightbox that is the user login. When they submit a form it checks if the user is logged in if not it needs to show the lightbox to let the user log in.

How can i do this out of the javascript.

This is the html code that makes the lightbox appear when the link is clicked.

<a href="#" class="popup-login">Login</a>

This is the javascipt i have so far, the else being when the user is not logged in. This is where i want the lightbox to show.

function islogin(){
    if(is_user_logged_in()){
        add_file_post();
    }else{

    }
}

Open login/registration via modal

UserPro has built-in support for modal or lightbox view which you can use to display any of its shortcode, just like standard shortcodes.

How to display the login form via modal or lightbox?

You need a menu item or a custom HTML link that has this class: popup-login That's it. An example should be:

<a href="#" class="popup-login">Login</a>
  • 写回答

1条回答 默认 最新

  • douwuying4709 2015-08-14 13:20
    关注

    This might not be the prettiest way to do it, but you can try executing the click() function on the anchor element.

    function islogin(){
      if(is_user_logged_in()){
        add_file_post();
      }else{
        jQuery('.popup-login').click();
      }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 为什么我写出来的绘图程序是这样的,有没有lao哥改一下
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败