AnimatedModel - Difficulty with functioning of multiple model boxes

I am attempting to set up multiple model lightboxes for various content using the Animated Model plugin Animated Model.

It is functioning with a single link, but when I try to create a duplicate box, it does not work. I believe this is due to the model target ID defined in the JS. Here is a working JSFiddle

Could someone offer suggestions on how I can implement multiple model boxes using this plugin?

<a id="demo01" href="#animatedModal">DEMO01</a> 
<div id="animatedModal">
  <div class="close-animatedModal"> CLOSE MODAL </div>
  <div class="modal-content"> 
    modal content goes here
  </div>
</div>

Answer №1

Initially, it is important to note that in your code snippet, two elements share the same IDs, which goes against best practices as each element should have a unique ID within a document. You can refer to my example on JSFiddle for clarification - JSFiddle

Utilizing JavaScript:

// Example 01
$("#example01").animatedModal();

// Example 02
$("#example02").animatedModal({
  modalTarget: 'animatedModal2'
});

Answer №2

Feel free to test out the following script:

$("#example").animatedModal({
            modalTarget:'modal-01',
            animatedIn:'slideInUp',
            animatedOut:'zoomOut',
            color:'#99cc00'                
        });

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

The JQuery .click event is not functioning properly following the implementation of an AJAX filter

I am encountering an issue with the function below. The function is designed to toggle a div's visibility when clicking on a link with the "show-more" class. It also successfully changes an icon. However, the problem arises when I use an AJAX filter o ...

Tips for implementing Unobtrusive Ajax requests using jQuery and Rails

Currently, I am working in Rails 3.1 and trying to achieve an AJAX call using jQuery without utilizing the form_for method. The page I am on is localhost:3000/posts/show/2. There is a button on this page that does not belong to any form. Upon clicking thi ...

What are the recommended guidelines for organizing files in an NPM package for front-end development?

I am creating an NPM package for the front-end and I'm trying to figure out the optimal file structure. My package consists of a code.js file as well as a code.min.js file. Should these files be located in the root directory, a dist folder, or a src f ...

What is the best way to implement two for loops in a Django template to handle sending and receiving chat messages efficiently?

I am attempting to implement sending and receiving messages in a Django template using a for loop. Here is my views function: @login_required def message_form(request, id, slug, user_id): user2 = request.user user_id = user_id user = get_objec ...

The $mdSticky feature in AngularJS Material seems to be malfunctioning

It's been a challenge for me to get the md-toolbar to stay in the top position. I decided to create a custom directive using the $mdSticky service in AngularJS. var app=angular.module('app',['ngMaterial']); app.controller(&apos ...

What is the best way to retrieve a specific number of documents from MongoDB?

I am currently facing an issue with my code that is returning all news related to a company. However, I only want the first 15 elements. Is there a way to achieve this? The following code snippet retrieves all news for a company using the google-news-jso ...

Adjust scrollbar thumb size using CSS

I am looking to customize my scrollbar with a larger thumb size compared to the track. While I can adjust the color and other properties easily, I am struggling to change the sizes of the thumb and track separately. .custom_scrollbar::-webkit-scrollbar { ...

HTML element resizing unexpectedly due to browser interactions

I recently created a sleek HTML transparent header bar using the following CSS: #head-bar{ position:fixed; top: 0px; width:100%; left:0px; min-height:25%; z-index:2; background-color:#000; background: rgba(0, 0, 0, 0.5); } ...

Is it possible for me to alter the script for my button's onclick

Is there a way to replicate all properties of a div when creating a clone using JavaScript code? I have an existing script that successfully creates a clone of a div when a button is pressed, but it does not copy the CSS properties. How can I ensure that t ...

Is there a way to refresh a URL link so that it remains unchanged after I click the submit button?

I'm currently working on a simple form: <div class="form-style-2"> <form action="" name="formular" id="formular" method="GET"> <label for="actual_position"><span>From: <span class="required"></span>< ...

Exploring the world of AngularJS for the first time

I'm currently delving into the world of AngularJS and I encountered an issue with my first example. Why is it not working as expected? Here's a look at the HTML snippet: <html ng-app> <head> <title></title> <sc ...

Configuring rows in React datagrid

I am working on a component where I receive data from the backend and attempt to populate a DataGrid with it. Below is the code for this component: export const CompaniesHouseContainer: React.FC<Props> = () => { const classes = useStyl ...

What is the best way to set up a horizontal navigation system on a webpage?

Below is the code for a horizontal page dragging navigation system inspired by www.blacknegative.com. In this system, users can click and drag left or right to navigate through different pages. The current setup allows for four pages, but I need to expand ...

Include an additional image with a JavaScript function

I recently started using a WordPress plugin known as User Submitted Posts. This plugin has the functionality to allow users to upload multiple images. I have configured it so that users can upload anywhere from 0 to a maximum of 3 images. However, when att ...

managing a multitude of requests to a node.js api

Recently, I was tasked with creating a straightforward REST API using Node.js and developing a script to populate the database with 10000 elements via API calls. Utilizing the Hapi framework, I set up the server. Interestingly, when sending either a single ...

Utilize Jquery Mobile ThemeRoller's design on your MVC4 mobile app for a cohesive and professional look

After creating an MVC4 Mobile application in Visual Studio 2013, I am struggling to apply jquery mobile themeroller themes to it. I attempted to replace the existing theme css with my custom theme, but it does not seem to be working at all. See the code ...

Unable to detect errors using React/Redux

I encountered a login error handling issue with redux that is structured like this: export const login = (params: any) => async (dispatch: Dispatch) => { try { const authData = await API.post("login", params); sessionStorage.setIt ...

Is there a way to extend the styles applied to elements after the page has finished loading?

I have created an application with a element positioned at the top of the page. Directly below this element is another div. Upon clicking a button within the first element, HTML content from a website is loaded into the second div, bringing along all its ...

The delete function is not functioning properly after clicking "add to cart," but it works perfectly once the page is

I am encountering an issue with my shopping cart page. When I click on the "add to cart" button, the page refreshes before allowing me to delete an item from the cart. However, if I reload the page after adding an item to the cart, the delete function work ...

Function cannot be triggered by pressing the ENTER key

I'm struggling to pass values to my function and make it run when I press the ENTER KEY in PHP The function I'm dealing with is called update() Below is the PHP code snippet: echo '<input type="text" size="23" id= n'.$row["Cont ...