首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >Ajax调用会导致jQuery代码行为不当并破坏布局。

Ajax调用会导致jQuery代码行为不当并破坏布局。
EN

Stack Overflow用户
提问于 2020-12-22 04:30:24
回答 1查看 74关注 0票数 0

好吧,我不知道还能怎么说。我有这个网站这里,它的代码在下面,它有使用jQuery的基本DOM操作。我想要包含一个弹出,它使用一个.html调用(在代码中实现)从外部的“jQuery”检索其内容。但是,每次进行Ajax调用时,javascript代码都会开始出现错误行为。例如,导航条自动更改颜色(棕色<->透明)和一些元素显示一旦用户滚动他们,开始以一种奇怪的方式(不工作或工作不当)。在其他情况下,甚至布局也会受到影响。

请参考页尾(页脚下方),尝试两个弹出触发器并查看它们的效果。我不知道代码的哪一部分要包含,所以只需把大部分代码都放进去。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
$(document).ready(function () {

    $('.carousel').carousel({
        interval: 5000
    });

    $('.carousel-fast').carousel({
        interval: 1000
    });

    $(window).on('load', function() {
        headerControl("onload");
        changeText("#right-down", 767, "To the right, you can see a picture of me during the last STEM Model UN!", "If you look down, you can see a picture of me during the last STEM Model UN!");
        
        $('.navbar-toggler').click(function() {
            headerControl("onclick");
        });
        $('.pop-up-call').each(function(i, el){
            $(el).click(function(){
                $.ajax({
                    type: 'GET',
                    url: el.dataset.content,
                    timeout: 5000,
                    success: function(data) {
                        $('#pop-up-content').html(data);
                    },
                    complete: function() {
                        $('#pop-up').removeClass('hidden');
                    }
                });           
            });
        });
        $('#pop-up-close').click(function() {
                $('#pop-up').addClass('hidden');
        });
    });

    $(window).on('resize', function() {
        headerControl("onload");
        changeText("#right-down", 767, "To the right, you can see a picture of me during the last STEM Model UN!", "If you look down, you can see a picture of me during the last STEM Model UN!");
    });

    $(window).on('scroll', function() {
        headerControl("onscroll");
    });
});

function isElementInViewport (el) {

    // Special bonus for those using jQuery
    if (typeof jQuery === "function" && el instanceof jQuery) {
        el = el[0];
    }

    let rect = el.getBoundingClientRect();
    return (
        rect.top >= 0 &&
        rect.left >= 0 &&
        rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /* or $(window).height() */
        rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */
    );
}

function showElements(check, el) {
    if (isElementInViewport(document.querySelector(check))){
        let elements = document.getElementsByClassName(el);
        for (let i = 0; i < elements.length; i++)
        {
            if (elements[i].classList.contains('visible-mobile')){
                elements[i].classList.toggle('visible-mobile');
                let string = el + '-animate';
                elements[i].classList.toggle(string);
            }
            else {
                break;
            }
        }
    }
}

function changeText(el, wd, lg, sm) {
    let docref = $(el)[0];
    if (window.innerWidth <= wd) {
        docref.innerHTML = sm;
    }
    else {
        docref.innerHTML = lg;
    }
}

function headerControl(n) {
    if (n === "onclick") {
        $('.navbar-bg').toggleClass('hidden');
        $('#ch-pic').removeClass('ch-pic-transit');
        $('#btn-learn-more-content').toggleClass('btn');
        if (window.innerWidth < 991) {
            $('.header-flex').toggleClass('visible-desktop');
        }
        else {
            $('.header-flex').removeClass('hidden');
        }
    }
    else if (n === "onload") {
        let header = $('.workflow-header')[0];
        let img = $('#img-bg')[0]; 
        let header_height = img.clientHeight;
        header.style.height = parseInt(header_height) + "px";
    }
    else if (n === "onscroll") {
        $('.navbar-bg').addClass('hidden');
        $('#navbarSupportedContent').removeClass('show');
        $('.header-flex').removeClass('visible-desktop');
        $('#ch-pic').addClass('ch-pic-transit');
        $('#btn-learn-more-content').addClass('btn');
        let rect = $('#img-bg')[0].getBoundingClientRect();
        if (rect.bottom <= 100)
        {
            $('.navbar').addClass('bg-light-onscroll');
            $('#logo').addClass('logo-small');
        }
        else
        {
            $('.navbar').removeClass('bg-light-onscroll');
            $('#logo').removeClass('logo-small');
        }
    }
}
代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
* {
    box-sizing: border-box;
    font-family: 'PT Sans', sans-serif;
    font-size: 20px;
    font-weight: bold;
    margin: 0px;
    padding: 0px;
}

html {
    scroll-behavior: smooth;
}

p {
    font-size: 14px;
    font-weight: 100;
}

thin {
    font-size: inherit;
    font-weight: normal!important;
}

bold {
    font-size: inherit;
    font-weight: bold;
}

old-english {
    font-family: 'engrvrsoldeng_btregular', 'PT Sands', serif;
    font-size: 2rem;
}

/* General */

.animate {
    transition: all 0.5s ease-in-out;
}

.hidden {
    visibility: hidden;
}

.visible-mobile {
    visibility: hidden;
}

.visible-desktop {
    visibility: visible;
}

@media (max-width: 991px) {
    .visible-mobile {
        visibility: unset!important;
    }
    .visible-desktop {
        visibility: hidden;
    }
}

/* Header */

.bg {
    position: absolute;
    width: 100%;
    height: 100%;
    min-height: 700px;  
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.bg-light {
    background-color: transparent!important;
}

.bg-light-onscroll {
    background-color: rgb(97, 68, 56)!important;
}

.bg-size {
    width: auto;
}

.workflow-header {
    width: 100%;
    height: 88vh;
    position: relative;
    min-height: 620px;
    z-index: -1;
}

.navbar-expand-lg .navbar-nav .nav-link {
    color: white;
    opacity: 0.6;
}

.navbar-expand-lg .navbar-nav .nav-link:hover {
    color: #f5f5f5;
    opacity: 1;
}

.navbar-expand-lg .navbar-nav .active .nav-link {
    color: #ffffff;
    opacity: 1;
}

.navbar-light .navbar-toggler {
    background-color: #b69d8c;
    opacity: 0.8;
    clip-path: circle(35%);
}

.navbar-light .navbar-toggler-icon {
    width: 25px;
    margin: 2px;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 1)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

.nav-bar .nav-bar-narrow {
    padding: 5px 15px!important;
}

/* .navbar .nav-item {
    font-size: 10px;
} */

.header-flex {
    position: absolute;
    display: flex;
    width: 100%;
    justify-content: center;
    text-align: center;
    color: white;
}

.header-column-flex {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    top: 60px;
}

.header-flex h1 {
    font-size: 28px;
    font-weight: bold;
}

.header-flex h2 {
    font-size: 20px;
}

.ch-pic-transit {
    transition: all 0.5s ease-in-out;
}

#ch-pic {
    margin: 30px 0px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    border: 15px solid rgba(82, 53, 36, 0.64);
}

#ch-pic:hover {
    width: 330px;
    height: 330px;
}

#logo {
    max-height: 45px;
    transition: all 0.5s ease-in-out;
}

.logo-small {
    max-height: 38px!important;
}

/* Pop-ups */
.pop-up ::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.pop-up {
  position: fixed;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background-color: rgba(32, 32, 32, 0.7);
  width: 100%;
  height: 100%;
  z-index: 1031;
}

.pop-up-window {
  width: 90%;
  height: 90%;
  padding: 15px;
  position: relative;
  overflow-y: scroll;
  scroll-bar-width: 0px;
  border-radius: 15px;
  box-sizing: border-box;
  background-color: #f9f9f9;
  box-shadow: 1px 1px 11px rgba(32, 32, 32, 0.5);
}

.pop-up-close {
  font-family: 'Open Sans', arial, serif;
  font-size: 1.1rem;
  font-weight: bold;
  color: rgb(140, 140, 140);
  float: right;
  cursor: pointer;
}

.pop-up-close {
  display: block;
}

.pop-up-close:hover {
  color: rgb(52, 52, 52);
}

.pop-up-content {
  clear: both;
}

.pop-up-call:hover {
  cursor: pointer;
}

/* sections */

brown {
    color:rgb(148,114,100)!important;
}

.section h1 {
    font-weight: bold!important;
    color: rgb(148,114,100)!important;
}

.section-colored {
    background-color: #f8f8f8;
}

.section-2-holder {
    min-height: 250px;
    height: fit-content;
    padding: 20px;
}

.section-flex {
    display: flex;
    width: 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#section-1 {
    position: relative;
}

#img-books {
    width: 350px;
}

#side-pic {
    width: 100%;
}

@keyframes upscale {
    from {transform: scale(0.1);}
    to {transform: scale(1);}
}

/* Cards */
.card {
    min-height: 200px;
    height: fit-content;
    background-color: white;
    padding: 15px;
    margin: 5px 0px;
    box-shadow: -1px 1px 12px rgba(148,114,100, 0.3);
    transition: all 0.5s ease-in-out;
}

.card-animate {
    transform: scale(0.1);
    animation-name: upscale;
    animation-duration: 1s;
    animation-fill-mode: forwards;
}
.card:hover {
    box-shadow: 1px 1px 10px rgba(148,114,100, 1.0);
}

/* Carousel */
.container-carousel {
    padding: 30px;
    width: 100%;
}

/* Timeline by Alan Houser */
.timeline {
  border-left: 4px solid rgb(148,114,100);
  border-bottom-right-radius: 4px;
  border-top-right-radius: 4px;    
  background: fade(white, 3%);
  color: fade(white, 80%);
  font-family: 'PT Sans', sans-serif;;  
  margin: 50px auto;  
  letter-spacing: 0.5px;   
  position: relative;
  line-height: 1.4em;
  font-size: 1.03em;   
  padding: 50px;   
  list-style: none;
  text-align: left;  
  font-weight: 100;  
  max-width: 60%;
}

.timeline-animate {
    animation: fade-in 1s ease-in-out;
}

.event {
    border-bottom: 1px dashed fade(white, 10%);
    padding-bottom: (25px);
    margin-bottom: 50px;  
    position: relative;
}

.event h3 {
    font-size: 1.2rem;
    hyphens: auto;
}

.event:last-of-type { 
      padding-bottom: 0;
      margin-bottom: 0; 
      border: none;      
}

.event::before, .event::after {
      position: absolute;
      display: block;
      top: 0;
}

.event::before {
      left: -193px;    
      color: fade(white, 40%);    
      content: attr(data-date);
      text-align: right;
      font-weight: 100;    
      font-size: 0.7em;
      min-width: 120px;
      font-family: 'PT Sans', sans-serif;;
}

.event::after {
      box-shadow: 0 0 0 4px rgb(148,114,100);    
      left: -57.85px;        
      background: white;    
      border-radius: 50%;  
      height: 11px;
      width: 11px;
      content: "";
      top: 5px;
}

@keyframes fade-in {
    from {
        transform: scale(0.1);
        opacity: 0.0
    }
    to {
        transform: scale(1.0);
        opacity: 1.0
    }
}

/* Footer */

.bg-black {
    background-color: rgb(97, 68, 56);
    min-height: 200px;
    padding: 20px;
}

.footer {
    color: white;
}

.footer h1 {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 0;
}

.footer ul {
    margin-top: 10px;
}

.footer li {
    list-style: none;
    display: inline;
    padding: 0px 10px 0px 0px;
}

.footer a {
    color: rgba(255, 255, 255, 0.767);
}

.footer a:hover, .footer a:focus {
    color: white;
}

.footer p {
    display: inline;
}

.icon {
    display: inline;
    font-size: 22px;
}

/* Buttons */
.btn-container {
    position: relative;
    display: inline-block;
    font-family: inherit;
    font-size: inherit;
    font-weight: bold;
    margin-bottom: 15px;
}

.btn {
    display: inline;
    position: relative;
    padding: 0;
}

.btn::before {
  content: attr(data-title);
  display: inline-block;
  padding: 12px 15px;
  border: 0px solid white;
  border-radius: 7px;
  outline: none;
  text-align: center;
  color: rgba(148, 114, 100, 1.0);
  background-color: white;
  box-shadow: 4px 4px 11px 0px rgba(32, 32, 32, 0.5);
  transition: all 0.5s ease-in-out;
}

.btn::after {
  content: attr(data-title);
  padding: 12px 15px;
  position: absolute;
  display: block;
  top: -14px;
  left: 0px;
  border: 0px solid white;
  border-radius: 7px;
  outline: none;
  text-align: center;
  color: white;
  background-color: rgba(148, 114, 100, 1.0);
  clip: rect(0px, 0px, 200px, 0px);
  transition: all 0.5s ease-in-out;
}

.btn:hover:before {
    background-color: rgb(148,114,100);
}

.btn:hover:after {
  clip: rect(0px, 200px, 200px, 0px);
  cursor: pointer;
}


/* RESPONSIVE */

/* 
Extra small devices (portrait phones, less than 576px) 
No media query since this is the default in Bootstrap because it is "mobile first"
*/

.side-img {
    position: absolute;
    bottom: -20px;
    left: -50px;
    z-index: -1;
    max-width: 250px;
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {  
    .side-img {
        left: -80px;
    }

    #img-books {
        visibility: hidden;
    }
}
 
/* Medium devices (tablets, 768px and up) The navbar toggle appears at this breakpoint */
@media (min-width: 768px) {  
    .event h3 {
        font-size: 1.7rem;
    }

    .event::before {
        font-size: 0.9em;
    }
 
}
 
/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) { 
    .container-carousel {
        padding: 50px;
        width: 100%;
    }
}
 
/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {  
    .side-img {
        left: -20px; 
        z-index: -1!important; 
    }

    #img-books {
        visibility: visible;
    }
}

/* Mobiles and Tablets only */

@media (max-width: 991px) {

    h1 {
        font-size: 2rem;
    }

    .timeline {
        max-width: 30%;
    }

    .side-img {
        left: -20px; 
        z-index: unset!important; 
    }

    .workflow-header {
        min-height: 610px;
        height: 100vh;
    }

    .navbar-collapse {
        position: absolute;
        top: 75px;
        right: 0;
        width: 140px;
        margin: 30px;
        text-align: right;
    }

    .navbar-bg {
        background-color: #2b1813;
        position: absolute;
        right: 0;
        top: 0;
        height: 100vh;
        width: 190px;
        opacity: 0.8;
        animation: slide-in 2s forwards;
    }

    .header-flex h1 {
        font-size: 20px;
    }
    
    .header-flex h2 {
        font-size: 16px;
    }

    #ch-pic {
        width: 220px;
        height: 220px;
    }

    #ch-pic:hover {
        width: 250px;
        height: 250px;
    }

    @keyframes slide-in {
        from {width: 0px;}
        to {width: 190px;}
    }
}
代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<!DOCTYPE html>

<html lang="en">
    <head>
        <title>Omar Ibrahim</title>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="icon" href="images/icon.png">
        <link rel="preconnect" href="https://fonts.gstatic.com">
        <link href="https://fonts.googleapis.com/css2?family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,800;1,800&display=swap" rel="stylesheet">
        <link href="fonts/engraves/stylesheet.css" rel="stylesheet">
        <link href="fonts/engraves/specimen_files/specimen_stylesheet.css">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
        <link rel="stylesheet" href="css/owl.carousel.min.css">
        <link rel="stylesheet" href="css/styles.css">
    </head>
    <body>
        <div id="pop-up" class="pop-up hidden">
            <div class="pop-up-window">
                <div id="pop-up-close" class="pop-up-close"></div>
                <div id="pop-up-content" class="pop-up-content">
                </div>
            </div>
        </div>
        <header id="section-0">
            <div class="bg">
                <img src="images/bg.jpg" alt="picture of library" class="bg-size" id="img-bg">
            </div>
            <nav class="navbar nav-bar-narrow navbar-expand-lg navbar-light fixed-top bg-light animate" style="padding: 5px 15px;">
                <a class="navbar-brand" href="index.html">
                    <img src="images/logo-sm-wh.png" alt="Logo" id="logo">
                </a>
                <div class="navbar-bg hidden"></div>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                  <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="navbarSupportedContent">
                    <ul class="navbar-nav mr-auto">
                      <li class="nav-item active">
                        <a class="nav-link" href="#section-0">Home<span class="sr-only">(current)</span></a>
                      </li>
                      <li class="nav-item">
                        <a class="nav-link" href="writing.html">Creative Writing</a>
                      </li>
                      <li class="nav-item">
                        <a class="nav-link" href="arts.html">Graphic Design</a>
                      </li>
                      <li class="nav-item">
                        <a class="nav-link" href="code.html">Programming</a>
                      </li>
                    </ul>
                </div>
            </nav>
            <div class="header-flex">
                <div class="header-column-flex">
                    <img src="images/pic.jpg" alt="picture of Omar" id="ch-pic" class="ch-pic-transit">
                    <h1>Omar Ibrahim</h1>
                    <h2>Creative Writer | Developer | Graphic Designer</h2>
                    <a href="#section-1"><div class="btn-container" id="btn-learn-more">
                        <div class="btn" id="btn-learn-more-content" data-title="Discover Omar!"></div>
                    </div></a>
                </div>
            </div>
        </header>
        <div class="workflow-header" id="workflow-header"></div>
        <div id="section-1" class="section container-fluid section-1">
            <div class="container my-3 p-3">
                <div class="row">
                    <div class="col-md-6">
                        <h1 id="section-1-nav">Wel<thin>come!</thin></h1>
                        <p>I am Omar Ibrahim, or you can just call me Adam, and I am a poet, computer science enthusiast/developer, and a graphic artists. I am also a debater/public speaker and have enjoyed a while exploring entrepreneurship and international politics. I aspire to work in the field of education where I can implement computer science in the expansion of educational opportunities, especially in literature. Currently, I study a STEM-focused Honors curriculum at STEM High School for Boys - 6th of October with an unweighted GPA of 4.0, highest (and only) composite ACT score of 35, and a total TOEFL score of 118.</p>
                        <p>I aspire to pursue higher education in the United States, somewhere that allows me to reach out to unexplored domains of knowledge and supports my desires to learn and discover new fields.</p>
                        <p id="right-down">To the right, you can see a picture of me during the last STEM Model UN!</p> 
                        <div class="container-fluid">
                            <div class="row">
                                <div class="d-flex justify-content-start" style="padding: 0px 15px 0 0;">
                                    <a href="files/resume.pdf" target="_blank"><div class="btn-container" id="btn-cv">
                                        <div class="btn" data-title="Download Résumé"></div>
                                    </div></a>
                                </div>
                                <div class="d-flex justify-content-between" style="padding: 0 15px 0 0;">
                                    <a href="#section-3"><div class="btn-container" id="btn-highlights">
                                        <div class="btn" data-title="Highlights"></div>
                                    </div></a>
                                </div>
                                <div class="d-flex justify-content-end" style="padding: 0 15px 0 0;">
                                    <a href="#section-4"><div class="btn-container" id="btn-gallery">
                                        <div class="btn" data-title="Gallery"></div>
                                    </div></a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <img src="images/pic-2.JPG" id="side-pic">
                    </div>
                </div>
            </div>
            <div class="side-img">
                <img src="images/books.png" id="img-books">
            </div>
        </div>
        <div id="section-2" class="section section-colored container-fluid my-3 p-3">
            <div class="row">
                <div class="col-md-12">
                    <div class="section-2-holder">
                        <div class="row">
                            <div class="col-md-4">
                                <div class="card visible-mobile">
                                    <div class="section-flex">
                                        <brown>
                                            <svg xmlns="http://www.w3.org/2000/svg" width="68" height="68" fill="currentColor" class="bi bi-blockquote-left" viewBox="0 0 16 16">
                                            <path fill-rule="evenodd" d="M2 3.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm5 3a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5zm-5 3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/>
                                            <path d="M3.734 6.352a6.586 6.586 0 0 0-.445.275 1.94 1.94 0 0 0-.346.299 1.38 1.38 0 0 0-.252.369c-.058.129-.1.295-.123.498h.282c.242 0 .431.06.568.182.14.117.21.29.21.521a.697.697 0 0 1-.187.463c-.12.14-.289.21-.503.21-.336 0-.577-.108-.721-.327C2.072 8.619 2 8.328 2 7.969c0-.254.055-.485.164-.692.11-.21.242-.398.398-.562.16-.168.33-.31.51-.428.18-.117.33-.213.451-.287l.211.352zm2.168 0a6.588 6.588 0 0 0-.445.275 1.94 1.94 0 0 0-.346.299c-.113.12-.199.246-.257.375a1.75 1.75 0 0 0-.118.492h.282c.242 0 .431.06.568.182.14.117.21.29.21.521a.697.697 0 0 1-.187.463c-.12.14-.289.21-.504.21-.335 0-.576-.108-.72-.327-.145-.223-.217-.514-.217-.873 0-.254.055-.485.164-.692.11-.21.242-.398.398-.562.16-.168.33-.31.51-.428.18-.117.33-.213.451-.287l.211.352z"/>
                                            </svg>
                                        </brown>
                                        <brown><h5>Creative Writer</h5></brown>
                                            <p style="text-align: center;">Poet and prose writer of 4+ years, Between the Lines: Peace and Writing Experience '20 Alumnus, Aster Literature Magazine Board Member, and TEDxYouth speaker</p>
                                            <a href="/writing.html"><div class="btn-container" id="btn-creative-writing">
                                                <div class="btn" id="btn-creative-writing-content" data-title="Read Pieces"></div>
                                            </div></a>
                                    </div>
                                </div>
                            </div>
        <div class="pop-up-call" data-content="https://omargfh.github.io/Omar-Ibrahim-personal-website/index%20(2).html">Call Pop Up</div>
<div class="pop-up-call" data-content="https://omargfh.github.io/Omar-Ibrahim-personal-website/nojs.html">Call Pop Up 2</div>
        <!-- jQuery (Bootstrap JS plugins depend on it) -->
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
        <script src="js/ajax-utils.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
        <script src="js/owl.carousel.min.js"></script>
        <script src="js/script.js"></script>
    </body>
</html>

EN

回答 1

Stack Overflow用户

发布于 2020-12-22 05:18:32

好吧,找出问题出在哪里。我基本上会通过Ajax调用将代码添加到我的网站中,这些代码可能有一些样式表声明,或者一个不同的引导版本,或者某个故障的*.js文件或其他什么东西,我会把它留在那里。所以,我想在终止弹出之前我必须先销毁添加的代码。

下面是修复(超时用于动画):

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
$('#pop-up-close').click(function() {
    setTimeout(() =>{
            $('#pop-up-content').html("");
            $('#pop-up').addClass('hidden');
    }, 1200);
});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65408792

复制
相关文章
MySQL 中使用时间戳
创建新记录和修改现有记录都更新方式 TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP 创建的时候设置时间,后续的修改不再更新 TIMESTAMP DEFAULT CURRENT_TIMESTAMP 创建的时候把字段设置为 0 ,以后修改才更新 TIMESTAMP ON UPDATE CURRENT_TIMESTAMP 创建时设置为给定值,以后更新会刷新这个时间 TIMESTAMP DEFAULT 'yyyy-mm-dd hh:mm
zucchiniy
2019/10/30
1.8K0
Spring Boot中使用时序数据库InfluxDB
除了最常用的关系数据库和缓存之外,之前我们已经介绍了在Spring Boot中如何配置和使用MongoDB、LDAP这些存储的案例。接下来,我们继续介绍另一种特殊的数据库:时序数据库InfluxDB在Spring Boot中的使用。
程序猿DD
2021/08/05
8940
Spring Boot中使用时序数据库InfluxDB
Excel VBA解读(143): 在自定义函数中使用整列引用时,如何更有效率?
Excel用户经常发现在公式中使用整列的引用很方便,这样可避免每次添加新数据时都必须调整公式。因此,当编写用户自定义函数时,可能会使用:
fanjy
2019/07/19
3K0
在Vue中使用Echarts
前端可视化是一个前端最基本的技能,要想做的好看,还是得借助一下百度家的echarts,那要怎么在Vue中使用echarts?这个官网没有给出实例,实例基本都是在jquery里面使用,引入的例子。
王小婷
2020/11/26
1.3K0
在Grafana中使用Variables
其实在公司内部使用Grafana完全是‘被逼的’。刚开始使用的时候完全是因为懒!也有考虑尽快的输出一些指标而不是走非常漫长的一个前、后、数据端的结伴开发。
CainGao
2020/04/14
12.7K4
在MATLAB中使用opencv
我们来说说第二类,需要做的事情是先编译opencv的源码、再编译matlab可用的mex文件夹,这两步的编译器必须是同一个,而最近几年的新版本matlab都推荐使用MinGW-w64编译器来使用mex、可是mexopencv提供的编译辅助函数在Windows系统上默认使用Visual Studio或者Windows SDK来编译,如果觉得自己需要Visual Studio的其他功能,安装一下也是挺好的
万木逢春
2019/10/09
6.2K0
在MATLAB中使用opencv
在 vuecli 中使用 echarts
可以按需引入的模块列表见 https://github.com/apache/incubator-echarts/blob/master/index.js
4O4
2022/04/25
2420
在 vuecli 中使用 echarts
在vue 中使用Stylus
Stylus => 一个CSS预处理器 安装 cnpm install stylus 初始化项目 vue init webpack filename cd filename cnpm install cnpm install stylus –save-dev cnpm install stylus-loader –save-dev npm run dev 使用 vue中使用Stylus .box background:red .... 引
大象无痕
2018/07/17
6930
在Go中使用Protobuf
本教程使用proto3版本的protocol buffer语言,提供了一个基本的在Go程序中使用protocol buffer的介绍。通过创建一个简单的示例应用程序,向你展示如何
KevinYan
2019/10/13
1.4K0
在Python中使用Elasticsearch
在这篇文章中,我将讨论Elasticsearch以及如何将其整合到不同的Python应用程序中。
小小科
2018/07/31
2.1K0
在Python中使用Elasticsearch
在Sequelize中使用迁移
迁移的好处,可以类比git。通过每次创建迁移文件,来支持更新,回滚数据库表结构,也方便协同开发,也避免人工手动去直接修改数据库,用代码自动管理。换个电脑,也不用去拷贝数据库,直接运行迁移就可以完全恢复开发环境,极大减轻了心智负担。
前端知否
2020/03/23
1.9K0
在ubuntu中使用supervisor
示例如下,在目录/etc/supervisor/conf.d/下创建redsocks2.conf,并加入:
羽翰尘
2019/11/20
6520
在vue中使用swiper
<template> <div class="main"> <!-- .swiper-container --> <div class="wrap"> <img class="bgImg" src="../../../../assets/images/fffbg.png" alt /> <swiper :options="swiperOption" ref="mySwiper"> <swiper-slide v-for="(item,index)
用户4344670
2020/02/13
6770
在Jetty中使用websocket
在工作中,我们有时候需要使用能与前端实时通信传输以通信,这种技术就是由Socket实现的,而Socket又有短连接和长连接之分,长连接技术就是我们今天要介绍的websocket。
Titan框架
2018/09/25
2.3K0
在Jetty中使用websocket
在 Flutter 中使用 WebView
我们知道在开发 Native App 时经常会有打开网页的需求,可供的选择通常只有两种:
出其东门
2019/08/09
3.5K0
在模板中使用函数
系统自带的函数,一般在functions.php中 // C函数,获取配置名称 <title>{:C('WEB_SITE_TITLE')}</title> // U函数,获取URL地址 <a class="brand" href="{:U('index/index')}">OneThink</a>
PM吃瓜
2019/08/12
1.2K0
在模板中使用函数
在Vue中使用Echarts
前端可视化是一个前端最基本的技能,要想做的好看,还是得借助一下百度家的echarts,那要怎么在Vue中使用echarts?这个官网没有给出实例,实例基本都是在jquery里面使用,引入的例子。
王小婷
2020/11/12
8170
在Vue中使用Echarts
在php中使用redis
说这么多就是为了表明,大部分情况下,redis是可以满足我们对于缓存的要求的。下面来说如何在php项目中使用redis作为缓存引擎。
ianzhi
2019/07/31
6460
在yii中使用memcache
说明: 1)class指明所有缓存类, CMemCache即为memcache 2) 当要使用多个cache轮询时,可以给每个cache配权重(weight)。如果只有一个cache,不加这个配置就可以了。
PHP学习网
2022/08/03
3200
点击加载更多

相似问题

openSSL的替代方案

20

Scala:废弃集差的替代方案

13

Environment.getExternalStorageDirectory()废弃替代方案

20

openssl_encrypt的替代方案

10

用于星火DataFrame的废弃DataFrame替代方案

15
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文