模式窗口上的标签标签不起作用

Label tags on modal window not working

本文关键字:标签 不起作用 窗口 模式      更新时间:2023-09-26

我正试图让我的模态窗口具有标签标签,这样我就可以创建一个登录窗口,但它们不会出现。这是一个链接我的小提琴

jQuery代码:

$(document).ready(function () {
    // create variable to hold the current modal window
    var activeWindow;
    $('a.modalLink').click(function (e) {
        // cancel the default link behaviour
        e.preventDefault();
        // find the href of the link that was clicked to use as an id
        var id = $(this).attr('href');
        // assign the window with matching id to the activeWindow variable, move it to the center of the screen and fade in
        activeWindow = $('.window#' + id)
            .css('opacity', '0') // set to an initial 0 opacity
        .css('top', '50%') // position vertically at 50%
        .css('left', '50%') // position horizontally at 50%
        .fadeTo(500, 1); // fade to an opacity of 1 (100%) over 500 milliseconds
        // create blind and fade in
        $('#modal')
            .append('<div id="blind" />') // create a <div> with an id of 'blind'
        .find('#blind') // select the div we've just created
        .css('opacity', '0') // set the initial opacity to 0
        .fadeTo(500, 0.8) // fade in to an opacity of 0.8 (80%) over 500 milliseconds
        .click(function (e) {
            closeModal(); // close modal if someone clicks anywhere on the blind (outside of the window)
        });
    });
    $('a.close').click(function (e) {
        // cancel default behaviour
        e.preventDefault();
        // call the closeModal function passing this close button's window
        closeModal();
    });
    function closeModal() {
        // fade out window and then move back to off screen when fade completes
        activeWindow.fadeOut(250, function () {
            $(this).css('top', '-1000px').css('left', '-1000px');
        });
        // fade out blind and then remove it
        $('#blind').fadeOut(250, function () {
            $(this).remove();
        });
    }

由于该而不显示的元素

<form id="overlay_form" style='display:none'>

只要到达这个

<form id="overlay_form">

然后也删除这个

<a href="#" id="close">Close</a>

因为您需要的是class=close,而不是id=close。

这是您的更新小提琴。已更改

 <form id="overlay_form" style='display:none'>

 <div id="overlay_form">

因为这种形式没有结束语,它本身就有另一个结束语。

演示

相关文章: