Issue arised while trying to open Bootstrap modal window due to conflict with surrounding elements

I'm facing a challenge with getting the bootstrap modal window to pop up on my website. Despite trying various solutions and troubleshooting steps, I haven't been able to resolve the issue.

Even after eliminating all scripts except for the bootstrap one, as well as removing CSS files, the modal still refuses to open. I even went so far as to delete manual code related to modals that I had previously inputted before incorporating bootstrap, but nothing seems to be working.

If you'd like to take a look at my codepen where the modal window code begins, you can find it here: https://codepen.io/eylenkim/pen/KKwMPLm

Here is an excerpt from the HTML section of my code:

<!--
   -- fix other <a> tags // fix navigation
   --fix "exit" for contact pop up (mobile)
   -- center the Contact dialog box on viewport in mobile
   -->
<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="utf-8"/>
      <title>Art By Eylen | Shop</title>
      <meta name="description" content="Browse Eylen's art portfolio to view work created with 35mm photography, blockprinting, and acrylic.">
      <meta name="author" content="Eylen Kim">
      <!--  data-src
         ––––––––––––––––––––––––––––––––––––––––––––––––––- -->
      <link href="subpage-stylesheet.css" rel=stylesheet type="text/css">
      <link href="StyleSheet.css" rel=stylesheet type="text/css">
      <link href="skeleton.css" rel=stylesheet type="text/css">
      <link href="otherCss/normalize.css" rel="stylesheet" type="text/css">
      <link href="otherCss/font-awesome.css" rel=stylesheet type="text/css">
      <link href="bootstrap-4.3.1-dist/css/bootstrap.css" rel=stylesheet type="text/css">
      <link href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet" type="text/css">
      <!-- Mobile Meta 
         ––––––––––––––––––––––––––––––––––––––––––––––––––-->
      <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
      <!--  Favicon
         ––––––––––––––––––––––––––––––––––––––––––––––––––-->
      <link rel="icon" type="image/png" href="photo/favicon1.png" />
   </head>

   ... (Omitted for brevity) ...

</html>

Answer №1

Two distinct issues are currently blocking the modal from appearing.

1) Code-related Problem

Your code is encountering a 404 error with the Bootstrap library.

  • To confirm if this issue affects you:
    • Access your browser's inspector by pressing CTRL+SHIFT+I
    • You will notice:
      • Failed to load resource: the server responded with a status of 404 ()   eylenkim/fullpage/bootstrap-4.3.1-dist/css/bootstrap.css
    • Multiple relative URLs in your code are facing similar challenges.

Solution

Replace the links to Bootstrap libraries with functional ones, for example from https://getbootstrap.com/

The following links were utilized during my testing of your code:

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="307877787d786f686179506133".net</a>/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

Visit the gist for a minimal code sample showcasing a modal here: https://codepen.io/edwin-chua/pen/rNaLOEg

After addressing the link issue, you will encounter the second obstacle.

2) Stylesheet Issue

Upon resolving your code as per my instructions, an opaque overlay without a modal appears.

Eliminating the reference to

https://eylenkim.github.io/ArtByEylen/StyleSheet.css
enables the modal display, suggesting interference with the modal's CSS.

A functional pen can be found at: https://codepen.io/edwin-chua/pen/QWwEyyZ

Additional Concern

Duplicate imports of certain libraries are evident, once in the Codepen UI and again in the HTML file. This duplication may lead to debugging complexities. Ensure that each library is imported only once. Given that you are constructing a complete webpage, consolidating everything within the HTML file is recommended.

https://i.sstatic.net/y7Jkh.jpg

Additionally refer to the JS tab

As well as

https://i.sstatic.net/iG1eW.jpg

Further Suggestions

This code segment appears aimed at closing the modal. If so, it might not be necessary since Bootstrap automatically binds click events.

<!--Modal - Dialog Boxes -->
   <script type="text/javascript"> const modals = Array.from(document.querySelectorAll('.modal'));
      const triggers = Array.from(document.querySelectorAll('.trigger'));
      var closeButton = document.querySelector(".close-button"); 

      //if a trigger is clicked then...
      for (const trigger of triggers) {
        trigger.addEventListener('click', toggleModal);
      }

      // .. then toggle it's modal
      function toggleModal(event) { event.target.closest('.trigger').querySelector('.modal').classList.toggle("show-modal"); }

        // check if the clicked element is a modal, or in a modal
      function windowOnClick(event) {
        if (modals.some((modal) => modal.contains(event.target))) {
          toggleModal();
        }
      }
   </script>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for effectively passing navigation as props in React Navigation with Expo

How can I correctly pass navigation as props to another component according to the documentation? The navigation prop is automatically provided to each screen component in your app. Additionally, To type check our screens, we need to annotate the naviga ...

When trying to gather multiple parameters using @Param in a NestJS controller, the retrieved values turn out

Can someone help me understand why I am struggling to retrieve parameters using the @Param() decorators in my NestJS controller? These decorators are defined in both the @Controller() decorator argument and the @Get() argument. I am relatively new to Nest ...

Table with a set height containing four cells (without scroll bars) and text allocated to each cell

I am looking to create a table in HTML/CSS with 4 cells stacked on top of each other. I have a couple of questions: How can I set the width and height for each cell individually (with varying heights), while ensuring that there are no scroll bars if th ...

When selecting an input within a div, the Angular onblur function is behaving erratically

How can I prevent the div from closing when I click on an input inside it after setting a tabindex to the div and closing it on blur? Solution for app.component.html: <button (click)="openToggle('toggle1')">Toggle 1</button> ...

Modifying JQuery function to target two IDs instead of just one

I am utilizing a bootstrap 5 tablist on my website that allows for navigating between tabs using custom left and right arrows. If I wish to introduce a second bootstrap 5 tablist with a new unique ID, how can I modify the code to integrate the new ID and e ...

Unable to verify the provided resource: Mailchimp

Welcome everyone to my first question posted on StackOverflow. I have tried my best to provide all the necessary details regarding the issue in order to seek assistance. If you require additional information, feel free to ask. To give a brief overview, I ...

tapping on the division and sliding it to and fro

I am trying to achieve a functionality where clicking a div will move another div to the right by 0, and on clicking the div again, the second div will move to the right by -200. However, I am facing issues getting it to work properly. $(document).ready(f ...

AngularJS allows for the creation of cascading dropdown selects, where the options in the second select

I'm struggling to access the version data stored in the server model, but it's not cooperating. My suspicion is that when the page loads, the initial data from the first select isn't available yet because it hasn't technically been sel ...

Implementing location functionality in Nextjs 13+ for both server-side rendering and client-side components

I need help displaying an active link in the header navigation. Previously, I used useRoute() for versions under 13, but it stopped working in version 13 and above. Additionally, useRoute is not mounted when using SSR. To work around this issue, I ensured ...

Issue with ReactJS not applying classes based on conditions

I'm currently working on toggling a class on an element when a user clicks. However, I am facing an issue where my code only sets the class for a single element and does not refresh for subsequent clicks. Even though the set class is not being removed ...

Having trouble configuring bcryptjs in a React.js project

I have been working on setting up a single registration page within a react component. However, I encountered an issue when trying to hash the password before sending the response to my back-end. I am puzzled as to why the code snippet below is not functi ...

What is the method for determining the new point coordinates and direction vector after a rotation of degrees in three.js?

How can I determine the coordinates of point A to H after rotating a certain number of degrees and aligning them with direction vector (-42, 51, 11) using three.js? Thank you in advance for your help and please forgive any mistakes in my English. Best reg ...

Issues with CSS Min-Height in Various Web Browsers

Lately, I've been working on a website and trying to create a border that surrounds all my content and extends the full length of the page. The #Container div is supposed to expand to fill the entire page. I've tried using min-height:100%; in my ...

Transition smoothly between two images with CSS or jQuery

I am working on a project where I need to implement a hover effect that fades in a second image above the initial image. The challenge is to ensure that the second image remains hidden initially and smoothly fades in without causing the initial image to fa ...

Encountering a Material UI error: Incorrect hook usage when combining create-react-library with MUI

After transitioning from Material Ui v3 to v4 on a create-react-library project, I encountered an issue. This particular project serves as a dependency for other projects in order to share components. However, when attempting to display a material-ui compo ...

Displaying selected list item while concealing the original

I have a dropdown menu with several options. What I am looking for is to have it so that when we click on the drop down, a list of choices appears. Then, when we select an option from the dropdown, the original selection should be replaced with the one th ...

Having trouble changing the icon in Google Maps during the event?

Seeking guidance with Google API V3 as a newcomer. The task at hand is to switch the icon during a zoom event. Everything works smoothly except for the part where I need to detect the change in zoom and modify the icon from a basic circle to Google's ...

"Utilize Node.js to seamlessly stream real-time Instagram photos based on a designated hashtag

Does anyone know of a node.js library or solution that can automatically fetch Instagram photos in real-time based on specific hashtags? ...

Looking to retrieve a specific portion of HTML data returned from an AJAX request

Looking to extract specific HTML content from the response received from an ajax call made to the controller. This task will involve utilizing an ID reference. I am encountering difficulty in employing the find function directly on the data as it is curre ...

Receiving a console notification about a source map error

Recently, I started receiving this warning in my console: "Source map error: request failed with status 404" resource URL: map resource URL: shvl.es.js.map" Has anyone encountered this issue before? I'm unsure of what it might be? This is my webpa ...