홈페이지에서만 자바 스크립트 팝업을로드하려면 어떻게해야합니까? 모든 페이지에 표시됩니다

스실 라미 하네

다음은 Javascript 코드입니다. 홈 페이지에만 표시하려면 어떻게해야합니까?

$(document).ready(function() {  

    var id = '#dialog';

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

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

    //transition effect
    $('#mask').fadeIn(500); 
    $('#mask').fadeTo("slow",0.9);  

    //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(2000);     

    //if close button is clicked
    $('.window .close').click(function (e) {
        //Cancel the link behavior
        e.preventDefault();

        $('#mask').hide();
        $('.window').hide();
    });

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

});
jcubic

이 수표를 추가 할 수 있습니다.

$(document).ready(function() {  
    if (window.location.match(/www\.infoways\.com\.np$/) || window.location.match(/www\.infoways\.com\.np\/$/)) {
        var id = '#dialog';
        // more of your code
    }
});

URL이 www.infoways.com.np또는로 끝나면 코드가 실행됩니다.www.infoways.com.np/

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관