Achieve a scrolling effect for just a specific section of an HTML page

Hey there! I'm currently working on adding scrolling text along the side of a webpage for a specific section. My goal is to have three different sections, each with text that stops scrolling when you reach it and then transitions to the next section on the opposite side. This is part of my personal website project, but I'm struggling with where to start in terms of coding.

Would anyone be able to assist me with this? Here's a link to a helpful example?

I've included only one section so far, as I thought it might make things easier. However, I can't seem to get the rotation effect to work. Is there something simple or basic that I may have missed?

CSS:

#vertical-text1 {
    transform: rotate(-90deg);
    transform-origin: left top;
    margin-top: 20px;
    position: relative;
    font-size: 5em;
    color: #000;

}

.photoset {
    width: 1050px;
    margin: 0 auto;
}

HTML:

<div id="vertical-text1"> Print Media </div>

<div class="photoset" data-layout="131">
  <img src="img/nature1.jpg" width="1000" height="1000" data-highres="img/nature1.jpg">
   <img src="img/nature2.jpg" width="333.3" height="333.3" data-highres="img/nature2.jpg">
  <img src="img/nature3.jpg" width="333.3" height="333.3" data-highres="img/nature3.jpg">
  <img src="img/nature4.jpg" width="333.3" height="333.3" data-highres="img/nature4.jpg">
  <img src="img/nature5.jpg" width="1000" height="1000" data-highres="img/nature5.jpg">
</div>
      </div>

Please note that the images are empty placeholders, but they are sized according to what I envision them to be in the final design.

Answer №1

Are you looking to make adjustments to different parts of your website based on how far the user has scrolled down?

$(document).scroll(function(){
    var scrollOffset = $(document).scrollTop();
    var photoset = $('.photoset')
    var minScrollOffset = photoset.position().top;
    var maxScrollOffset = photoset.position().top + photoset.height();
    if(minScrollOffset > 0 && scrollOffset < maxScrollOffset){
        $(".photoset-fix").addClass("lock");
    } else {
        $(".photoset-fix").removeClass("lock");
    }
});

UPDATE: http://jsfiddle.net/78wcaf6d/1/ In order to make this code more versatile, it would be helpful to know the names of the other sections (and possibly require adjustments to the HTML).

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

Ensure that the tooltip remains visible within the confines of the page

In my Angular application, I have successfully implemented a versatile tooltip feature that goes beyond just displaying text. The tooltip is a div element that has the ability to contain various contents: .tooltip-master { position: relative; .tooltip ...

Struggling to set the value for a variable within an Angular factory?

When dealing with a variable as an array, I have no trouble pushing objects inside and retrieving the values within the controller. However, when trying to directly assign an object to that variable, I run into issues. If anyone can assist me in achieving ...

Scroll horizontally in a div with a minimum width while it is contained within a column using Bootstrap

I am seeking to create a bootstrap v4 grid with 3 columns, where certain content within the columns require a minimum width. This necessitates a horizontal scroll (overflow-x), but I am encountering some overlap where the scrollbar and content extend beyon ...

Identify alterations in an input field after selecting a value from a dropdown menu

Is there a way to detect changes in the input field when selecting a value from a drop-down menu, similar to the setup shown in the image below? html: <input type="text" class="AgeChangeInput" id="range"/> js:(not working) <script> $(docume ...

Struggling to understand the javascript snippet "requiring the passport file and passing in passport as a parameter."

I am still learning the ropes of javascript and currently working on a basic login restful api using the passport middleware. I understand that when I use require('xxxxx'); I am importing a module for use. While researching online, I came across ...

AngularJS Toggle Directive tutorial: Building a toggle directive in Angular

I'm attempting to achieve a similar effect as demonstrated in this Stack Overflow post, but within the context of AngularJS. The goal is to trigger a 180-degree rotation animation on a button when it's clicked – counterclockwise if active and c ...

There is no response provided by the function

Here is the code for inserting data into the database. However, it seems to be going into the else section as the response is empty. I have checked by alerting the response, but it remains empty. // Function to add donation via AJAX function ccjkfound ...

PHP code cannot be outputted to JavaScript due to a syntax error

Although there is a syntax error, the code seems to be working. I am curious about how to make it syntactically correct. The provided code snippet is part of a script that sets up variables for an Ajax call. Depending on the scope, the corresponding varia ...

Tips for adding additional rows or cells to a table with jQuery

Similar Questions: How to Add Table Rows with jQuery Adding Rows Dynamically using jQuery. I am currently working with a table that contains one row and five editable cells for user input. My goal is to implement an "Add Row" feature using jQuery ...

Is it possible to modify the default behavior of a sensitive region within a button?

I created a calculator application in React and overall, it's working fine, however... I've noticed that when I hold a click longer, it only registers as a click if the mouse was pressed down and released on the button itself. Although I unders ...

"Exploring the Intersection of Meteor, NPM Packages, and Fiber Callbacks

I am currently utilizing request and cheerio to extract specific content, particularly a quote, from a website. Here is the code snippet ( server.js ) : q = new Mongo.Collection('quotelist'); postList = new Mongo.Collection('quotes&apos ...

Expanding the width of the textfield is not possible in CSS styling

My current search bar design features an input area that does not match my expectations. The input length is restricted and starts from the center rather than the black border I had envisioned. If you'd like to see the code and design in action, chec ...

Bootstrap component malfunctioning and not performing as expected

Currently, I am learning how to use Bootstrap and attempting to replicate the example themes found on their official website. The specific theme I am focusing on is available at this link: https://getbootstrap.com/docs/4.3/examples/pricing/ Unfortunately, ...

Determine the maximum and minimum numbers by inputting a number and utilizing jQuery

<script type="text/javascript"> function findLargestNumber() { var number1, number2; number1 = Number(document.getElementById("N").value); number2 = Number(document.getElementById("M").value); if (number1 > numb ...

The redirection to the webpage is not occurring as expected

I've been attempting to redirect another webpage from the homepage in my node server. However, the redirect isn't working as intended to link to idea.html, where the relevant HTML file is located. Can anyone assist me in identifying any errors in ...

What could be causing my CSS parallax effect to not work as expected?

I have been attempting to implement the parallax image technique following the Keith Clark tutorial, but I am facing difficulties in getting it to work correctly. Utilizing the skeleton CSS framework, my goal is to recreate an existing website in order to ...

HTML5 enables users to pick their preferred font style

In my JavaScript and HTML5 course, I am working on developing a website where users can choose the background color and decide between using SANS SERIF or SANS fonts. The background color selection feature is already functioning successfully -- var inputC ...

Error: Query has already been processed: Updating Todo with ID "612df063a8f"

After updating mongoose to the latest version (6.0.2), I encountered an error that crashes the application whenever .updateOne() is executed. However, the object is still updated inside the database. Below is my code snippet: async(req,res) => { a ...

Which property within the <mat-option> element is used for toggling checkboxes on and off?

I'm experimenting with dynamically checking/unchecking a checkbox in mat-option. What attribute can I use for this? I've successfully done the same thing with mat-checkbox using [(ngModel)]. Here's the snippet of my code: app.component.html ...

I'm looking to customize the background color and font size for an accordion in Bootstrap 4 with Vue.js. Can anyone provide guidance

Hello, I am currently using an accordion with Bootstrap 4 and Vue.js. Here is the code snippet: <div class="faq_accordion" role="tablist"> <b-card no-body class="mb-1"> <b-card-header header-tag=" ...