Scroll the second div to align with the first div

I am in need of a scrolling set of divs that functions like a slide show. I have been searching for a solution but haven't found one yet. Is there a way to make the commented-out div scrollable by clicking somewhere on the page or an arrow image? I want it to transition smoothly on click without having to reload the page for each "slide." Additionally, I would like the option to go back to the home section.

HTML:

<div id="wrapper_home">
    <div id="tey_home">
        <div id="tey_button"> 
            <a href="tey.html"><img src="images/tey_logo-01.png" width="239" height="239" alt="tey_logo" /></a>
        </div> 
    </div>
    <!--
    <div id="afiw_home">
        <div id="home_button"> <a href="home.html"><img src="images/home.png" width="52" height="52" alt="home" class="withfadeout"/></a> </div>
        <div id="afiw_button"> 
            <a href="afiw.html"><img src="images/afiw_logo-01.png" width="460" height="142" class="withfadein2"/></a>
        </div>-->
</div>
</div> 

CSS:

.withfadein {
    opacity: 0;
    -webkit-animation: load 20s linear forwards;
}

@-webkit-keyframes load{
    from{opacity: 0;}
    to{opacity: 1;}
}
.withfadein2{
    opacity: 0;
    -webkit-animation: load 10s linear forwards;
}

@-webkit-keyframes load{
    from{opacity: 0;}
    to{opacity: 1;}
}
.withfadeout { 
    -webkit-transition: all 2s ease-in-out; 
    -moz-transition: all 2s ease-in-out; 
    -ms-transition: all 2s ease-in-out; 
    -o-transition: all 2s ease-in-out; 
    transition: all 2s ease-in-out; 
} 
.withfadeout:hover { 
    -webkit-opacity: 0.25; 
    -moz-opacity: 0.25; 
    opacity: 0.25; 
}
#wrapper_index {
    height: 686px;
    width: 1024px;
    background-color: #000;
    margin-right: auto;
    margin-left: auto;
    margin-top: 50px;
    background-image: url(images/entry_image-01.png);
    background-repeat: no-repeat;
    position: relative;
}
#enter_button {
    width: 140px;
    position: absolute;
    left: 434px;
    top: 501px;
}
#wrapper_home {
    height: 686px;
    width: 1024px;
    background-color: #000;
    margin-right: auto;
    margin-left: auto;
    margin-top: 50px;
    position: relative;
}
#afiw_home {
    background-image: url(images/afiw.png);
    background-repeat: no-repeat;
    height: 686px;
    width: 1024px;
    position: relative;
}
#afiw_button {
    height: 142px;
    width: 460px;
    position: absolute;
    left: 276px;
    top: 275px;
}
#home_button {
    height: 52px;
    width: 52px;
    padding-top: 50px;
    padding-left: 50px;
}
#tey_home {
    background-image: url(images/tey-01.png);
    background-repeat: no-repeat;
    height: 686px;
    width: 1024px;
    position: relative;
}
#tey_home #tey_button {
   position: absolute;
    height: 239px;
    width: 239px;
    left: 399px;
    top: 222px;
}

Thank you very much for any assistance.

Answer №1

Utilizing jQuery is recommended:

$(document).ready(function(){
  $("button").click(function(){
    var div=$("div");
    div.animate({height:'300px',opacity:'0.4'},"slow");
    div.animate({width:'300px',opacity:'0.8'},"slow");
    div.animate({height:'100px',opacity:'0.4'},"slow");
    div.animate({width:'100px',opacity:'0.8'},"slow");
  });
});

This function captures a 'click' event, but feel free to customize it according to your needs

Answer №2

Utilize the .animate method in jQuery library

let target = $("Designated Target Div")
$("Div to soar").animate({'top': target.offset().top,
                         'left':target.offset().left}, 1000);

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

Is it possible to use Javascript to query the neo4j database?

After creating a geohash neo4j database for NYC Taxi data, the next step is to visualize it on a map. I decided to use Leaflet as a JavaScript library. Using static data, I was able to plot geohash data in Leaflet: https://i.sstatic.net/AtQKZ.jpg Now, my ...

What is the method for presenting text based on the chosen Select Option?

I attempted to achieve this using hrefs and ids, but it did not meet my requirements. This is the desired format: div.selectcountry { margin-bottom: 10px; font-family: arial; font-size: 12px; } div.countrydepartment { font-family: ...

techniques for utilizing dynamic variables with the limitTo filter in AngularJS

<div class="container"> <div class="row" ng-repeat="cmts in courCmt.argument" ng-init="getUserInfo(cmts)"> <div class="col-sm-1 col-xs-2"> <div class="thumbnail"> &l ...

What causes the issue of JavaScript code not loading when injected into a Bootstrap 4 Modal?

I've created a JavaScript function that triggers the opening of a Bootstrap Modal Dialog: function displayModal(message, headerMessage, sticky, noFooter){ var modal = $('<div />', { class: 'modal fade hide ...

Query the Mongoose database to fetch all records that are not listed in the array field of the same collection

I am facing a challenge with my Post schema. Within this schema, there is an array field that can contain other posts as replies. My goal is to retrieve all the documents that are not referenced in any post's replies field. Essentially, I want to extr ...

Using AngularJS, complete and send in the form

What is a simpler way to submit a form using AngularJS without utilizing an angular ajax call or adding the action="xxxx" attribute to the form? An example scenario could be a large form where assigning a model for each field isn't feasible, and send ...

Error in Node.js (NPM Error)

Recently, I purchased a VPS running Ubuntu 14.4 and successfully installed Node.js 1.4. However, when attempting to run my script (node tradebot.js), I encountered the following error message! :-/ module.js:327 throw err; ^ Error: Cannot find ...

Including extra js files disrupts the jQuery IntelliSense functionality

After enjoying the benefits of jQuery IntelliSense in VS2008, I decided to add a reference to jQuery UI. However, upon doing so, I noticed that the jQuery IntelliSense disappeared. It seems that referencing another .js file in the document causes this is ...

Tips for repairing the gray margins on the right and left sides of a webpage

Currently utilizing Bootstrap 5 and incorporating columns within the framework. However, encountering an issue where there is black space on the right side of the screen and certain content disappearing on the left side as demonstrated here. Here is the c ...

What are the differences between using attachShadow with the "mode" set to open compared to closed

I've recently delved into the world of Shadow DOM through some casual video watching. It seems like many people are quick to dismiss this feature, with comments like "Just keep it open" and "It's less flexible when closed." attachShadow( { mode ...

Reorder an array of objects in JavaScript alphabetically, taking into account any possible null values

Encountering a problem with sorting contacts by first name, especially when some contacts are missing this information. Any suggestions on how to modify the method for such cases? Thanks! This is the current sorting function I am using: function sortAZ(o ...

Transform URL Structure with UrlRewrite and htaccess - A Step-by-Step Guide

Currently, I am using the following URL: http://server.com/index.php?page1=main&page2=contacts I would like to change it to: http://server.com/main/contacts Can anyone provide guidance on how to write an .htaccess file with sample code for this red ...

How can CSS be used to change the text color of input placeholder in Edge Browser?

While using Edge Browser, I encountered an issue where I was unable to change the input placeholder color. The :-ms-input-placeholder selector was not working on Edge, although it functioned properly on IE 10 and IE 11. input:-ms-input-placeholder { ...

Code formatting for MVC HTML layout in C#

When working with asp.net mvc views, I like to incorporate C# logic that handles layout in the following manner: <% if (Model.People.Count > 0 ) { %> <% foreach (var person in Model.People) { %> ... <% }} else { %> & ...

The error message "Unexpected style type encountered while loading model in ifc.js" was displayed

When I try to load IFC files using the ifc.js library, I frequently encounter numerous messages like the following in the console: Unexpected style type: 3800577675 at 213152 (web-ifc-api.js: 933) Unexpected style type: 3800577675 at 213511 (web-ifc-api.js ...

Trouble implementing array filter in React component is a common issue

Hello everyone! I'm facing an issue with deleting an element from my useState array. I have the index of the element that I want to remove, and I've tried the following code snippet: const updatedArray = myArray.filter((item: any, index: number) ...

Domain Error Crossed

My issue is that I am working with cross-domains and making an ajax request to the same domain, let's say Domain A. However, I keep encountering an error saying 'No Access-Control-Allow-Origin'. $.ajax({ type: 'get', url: ...

Express: How to Define Route Parameters from the Client Side

app.get('login/:id', function (request, response) { … }); I am curious about how the :id parameter is assigned from the user in a request like this. Since each user will have a unique id on my site, I wonder how it works. Does the user need ...

Column reverse flex-direction is functioning correctly, however, it is imperative that it does not automatically scroll to the bottom

I have a Flexbox set up where I need the contents to display in reverse order. Everything is working well, but the list has many items and the newest ones are appearing at the top. Currently, the Flexbox automatically scrolls to the bottom, but I want it t ...

Ways to integrate vanilla JavaScript with VueJS

I am currently working on implementing a vuejs component and could use some guidance. Can anyone provide assistance on where to place the JavaScript code in order for it to function correctly? As a newcomer to vuejs, I am still uncertain about how to prope ...