Activate the button to effortlessly load pages with a visually engaging animation

I have been facing a problem for the past couple of days. I need help with achieving a specific functionality on my website. When button1 is clicked, I want to load the page in a div class named "loadpage" with an animation coming from the left. Similarly, when button2 is clicked, the animation should start from the right. Finally, when button3 is clicked, I want to load page 3 from the center. Can someone please assist me with this?

      <div id="main">    
        <div class="home">
         <button>1</button>
         <button>2</button>
         <button>3</button>
        </div>
        <div class="loadpage"></div>

     </div>

     <div id="page1"></div>
     <div id="page2"></div>
     <div id="page3"></div>

Answer №1

Not sure exactly what you're looking for, but I believe something like this might be what you need.

 $(document).ready(function (){
           $('#yourpage1id').hide();
           $('#yourpage2id').hide();
           $('#yourpage3id').hide();
      $('#yourbutton1id').click(function (){
           $('#yourpage1id').show();
      });
      $('#yourbutton2id').click(function (){
           $('#yourpage2id').show();
      });
      $('#yourbutton3id').click(function (){
           $('#yourpage3id').show();
      });
 });

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

Injecting jQuery into dynamically loaded contentORLoading jQuery within

Is it necessary to call jQuery again when loading content via ajax that contains additional ajax interactions? Should scripts/plugins specific to the loaded content be called only within the loaded content or in the parent file? Appreciate your response! ...

utilizes arrays using the $.ajax method in jQuery, then transfers them to a PHP endpoint

jQuery(document).ready(function(){ // Setting the data text var dataText = " { name: 'John', time: '2pm' }"; alert(dataText); // Making an AJAX request $.ajax({ type: "POST ...

How can DataTables (JQuery) filter multiple columns using a text box with data stored in an array?

I've been attempting to create a multi-column filter similar to what's shown on this page () using an array containing all the data (referred to as 'my_array_data'). However, I'm facing issues with displaying those filter text boxe ...

Tips on altering the h2 color when hovering using h2:hover:after

I'm attempting to alter the color of my h2 element using h2:hover:after. Can someone guide me on how to achieve this? Here is what I have tried so far. h2 { font-size: 25px; } h2:after { content: ""; display: block; width: 14%; padding-to ...

Storing information in local storage based on the currently logged-in user

Is there a way to store the information of the currently logged in user using AngularJS? For example, if user1 is logged in, can I display only that user's details on the page? How can I assign unique keys for each logged in user? ...

Why is it that an HTML entity-containing string doesn't show the character after going through the htmlspecialchars() function?

In my project, I have a string of text retrieved from the SQL database which is then sanitized using PHP's strip_tags and htmlspecialchars functions to eliminate any HTML formatting that users might try to inject. This processed text is displayed in b ...

Using Spring Boot RestController to Serve HTML Pages

I'm having trouble accessing the HTML page I created. Here is an overview of my project: This is the "IndexController" class: @RestController @AllArgsConstructor @RequestMapping(path = "/webpage") public class IndexController { @GetMapping(p ...

How can Jquery Globalize be used to format months with leading 0's?

Despite reviewing the documentation, I am unable to find a solution to my issue. However, I have the following formatter: Globalize.dateFormatter({skeleton: "yMd"}); This formatter currently produces dates in the format 8/24/2015. What I need is for it t ...

What are the steps to achieve such a design?

Can you show me how to create a single layout using HTML and CSS? I am struggling with splitting the screen properly. Could you provide a simple example, maybe on jsfiddle? https://i.stack.imgur.com/d2rbn.jpg Thank you in advance! EDIT: I have added a ...

The $_GET variable disappears once the form is submitted

Here's the issue I'm facing: On my homepage, there are tables with rows generated from the database using while loops. Each row includes a cell where an event can be added to that specific row. To achieve this, I pass the row ID as a $_GET variab ...

The error message received states: "materialize-css Uncaught TypeError: Vel is not defined as

My current setup involves webpack as the bundler/loader, and I've successfully loaded materialize css (js/css). However, when attempting to use the toast feature, an error is thrown: Uncaught TypeError: Vel is not a function The library is being inc ...

What is the best way to initiate a loading event once the window has completely finished loading?

I am currently working with a framework (vue.js) that inserts images when there is a page change, without actually refreshing the entire page. When the page is loaded directly, I can implement a loading screen using the following code: loading = true; $(w ...

Is there a way to determine which radio button has been chosen using jQuery?

I'm trying to retrieve the value of the selected radio button using jQuery. Can anyone help with this? Currently, I am able to target all radio buttons like so: $("form :radio") But how can I determine which one is actually selected? ...

Adjust the positioning of divs to account for changes in scale caused

I have 3 div blocks arranged on a web page, with the first one bigger and located on the left side while the other two smaller ones are positioned on the right side. I want their relative positioning to remain fixed across all browsers and zoom levels. Cur ...

Fill an object with data and send it using jQuery's ajax function

I'm facing an issue in my JSP page with multiple input tags having the same ID 'opt'. My goal is to extract the values of all these input tags and generate a list as shown below: Votes= { vote={opt:'one'}, vote={opt:'two&apos ...

What steps do I need to take to make this JavaScript code function properly? How can I create a carbon copy email setup in

Recently, I've been struggling to implement this particular code on my website as I am not very proficient in JavaScript. Despite searching for various online resources, none of them seem to address my issue. This code is meant to be a part of a form ...

Is the Ajax call being triggered unexpectedly?

I've been working on an Ecommerce website and everything was going smoothly until the update_cart (quantity) code started submitting my form instead of updating it. I've tried making changes and even moving it outside the form, but the issue rema ...

Issue with IE failing to load a particular Stylesheet

Have you had a chance to view this live demonstration? My website has two different stylesheets, one specifically for Internet Explorer and another for regular browsers. Here's how they are set up in the header: <link rel="stylesheet" type="text/c ...

Conceal the unstyled element and reveal its adjacent sibling?

I have come across some HTML code that I am unable to modify. Instead of using JS/jQuery, I prefer a solution with cross-browser compatible CSS. The structure of the HTML is as follows: <ul class="list"> <li class="item"> <a hr ...

Is it possible to pass a function as an argument to another function in jQuery?

My function accepts a JSON object as a parameter containing User id, password, success callback, and error callback. The goal is to authenticate the user using an AJAX service. If the service response is successful, I want to call the success callback fun ...