Incorporate CSS calculations dynamically as you scroll

I'm attempting to create a smooth scrolling effect using basic jquery, but it's not functioning as expected. Oddly enough, the exact same code works perfectly in a test environment.

When I load the page, the code appears to be loading properly and there are no errors in the console. However, I'm completely stumped as to what could be causing the issue.

You can see that it works in CodePen here: http://codepen.io/anon/pen/KzOKYM?editors=1111

The SASS (uncompiled) and JS code snippets are provided below:

$(window).scroll(function() {
  youtubeVidScroll();
});
function youtubeVidScroll() {

  var wScroll = $(window).scrollTop();

  $(".video-strip").css("background-position": "calc(50% - " + wScroll + "px) center");
}

// SASS
.video-strip
  width: 100%
  height: 100%
  position: absolute
  background:
  image: url(../images/video-strip.png)
  repeat: repeat-x
  size: 400%
  background-position: calc(50% - 0px) center

https://github.com/DatScreamer/Screamer-Portfolio

EDIT:

Despite stripping down my files to only include the CodePen content, the scrolling effect still doesn't work. It's now apparent that the issue lies somewhere between linking the JS file and the browser actually reading it. Even a simple jQuery function like (.hide()) is failing to work.

Answer №1

The issue turned out to be the presence of overflow: hidden in the _base.sass file under html, body, which is rarely utilized as it's a personal boilerplate. Once that code was eliminated, everything started functioning properly. It was surprising to realize I had added an overflow property to the _base.sass without remembering.

I appreciate the advice offered in the comments, even though they were a bit sparse...

On another note, I believe this question is valuable for novice JavaScript learners who may not be aware that overflow can interfere with scrolling and other functionalities.

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

Get ready for the never-ending Javascript alerts!

I am currently developing a script to disable the right-click functionality on images and display a copyright message when attempted. To elaborate on how this functions, the image is contained within a model that remains hidden until triggered by another I ...

How can I maintain the

I have created a menu with left and right borders to separate each item. When I hover over the menu, the background color changes to a lighter shade, which is the desired effect. However, the hover effect covers up the left border. How can I prevent the bo ...

How can you ensure that a row of content is accessible by making it clickable in a valid way?

I'm currently working on developing a widget that resembles a clickable bootstrap media object list that is easily accessible. https://getbootstrap.com/docs/4.3/components/media-object/#media-list The original code has the JavaScript click event attac ...

Cannot find JS variable after loop has completed

I am struggling to understand why the value of my variable is not changing in my function. Here is my code snippet: var count = function(datain){ let temparr = [], countobj = {}; $.each(datain, function(key, val) { console.log(temparr); cou ...

"Encountered a snag while trying to install jQuery on Node.js

I'm in the process of installing jQuery on Node.js. Here's what I've done: npm install jquery However, when I did this, I encountered the following error: Building the projects in this solution one at a time. To enable parallel build, ple ...

use jquery to add only the first row to the query

I am currently facing an issue with my script when trying to add products to the cart. The script works perfectly fine for the first row, inserting the art.code and number of items without any problems. However, if I try to add a different article further ...

Stop users from typing specific word in textarea

I'm currently working on a website and I want to prevent users from entering certain words like ".com" or ".net". If any of these words are entered, I simply want them to be replaced with a space. I've already implemented JavaScript code that rep ...

Tips for removing a DOM element in Selenium using Java

Recently, I've been attempting to remove an element from a website using Selenium and Java with the xpath of the element readily available. WebElement m = driver.findElement (By.xpath ("//*[contains(text(),'discord.gg/')]")); The specific e ...

Error encountered at /edit-menu/edit/: The 'Product' object does not contain the attribute 'is_valid'

I am attempting to extract all product names from the Product model, display them along with their prices on the screen, and enable users to modify the price of any item. Although I have managed to list them out and provide an input field for the price, I ...

The offset value was inconsistent in the desktop version of Firefox

Could you take a look at my code on the fiddle link, Here is the code snippet: <body> <div id="content" style="width:400px; height:110px;"> <svg id="circle" height="300" width="300"> <circle cx="150" cy="150" r="40" st ...

Aurelia is having trouble locating jQuery UI components

Below is my proposed solution. I am looking for suggestions on how to enhance it, so please feel free to recommend improvements! I am currently utilizing Aurelia CLI for my web application. I am attempting to integrate jQuery tabs and jQuery datepicker, b ...

Removing numerous columns from an array on the fly

Currently, I am exploring ways to eliminate multiple columns from an array of objects based on a dynamically selected list of values. If my goal is to delete a specific column, the approach would be as follows: Given the array: arr = [ { "THEDAT ...

Steps for adding an item to the datasource in a Kendo UI Combobox manually

I am facing an issue with a combobox that is being populated using a JSON string received from a servlet. $(document).ready(function() { //Combobox Init (From Servlet) var comboBoxDataSource = new kendo.data.DataSource({ transport : { ...

What methods can be utilized to create sound effects in presentations using CSS?

Let us begin by acknowledging that: HTML is primarily for structure CSS mainly deals with presentation JS focuses on behavior Note: The discussion of whether presentation that responds to user interaction is essentially another term for behavior is open ...

Align an element to the right side of the webpage using CSS

I've been struggling to align elements to the right side of the page using various methods like float and flex, but nothing seems to work. To make it easier to understand my issue, I've attached a picture that illustrates what's going on. I& ...

Troubleshooting: My jQuery script for fading in content upon document ready is not

I'm currently working on a website where I want everything to fade in when the user enters the site. Take a look at my code: var celyLogin = $(".container"); $(document).ready(function () { /*! Fades in page on load */ $("container") ...

Using Material UI's DropDownMenu to achieve full height coverage

On a specific page, I have a DropDownMenu embedded inside a table column. Whenever I try to open the menu, it expands to 100% of the page height. I couldn't find any information regarding this issue in the documentation or community forums. The chi ...

Issue with Playing Ogg Audio in Chrome When Using Accept-Ranges:Bytes

Having trouble reproducing Ogg audio files using HTML5? Check out the server configuration in BasicHandler.ashx: string oggFileName = @"C:\Users\gustav\Desktop\Player\Files\TestAudio.ogg"; byte[] bytes = File ...

Wanting to create an infinite amount of distinctive identification codes using jQuery

As a beginner here, I'm facing a challenge with generating unique IDs for a number of elements using jQuery. The elements are dynamically created on the back end, so there could be quite a few of them. Any assistance would be highly appreciated. In t ...

What steps can be taken to repair the footer area within this CSS document?

As a beginner ASP.NET developer, I am encountering CSS for the first time. The CSS file I have is fairly simple, but I am facing difficulties with the footer section. The current appearance of the footer is as follows: I am looking to make the following m ...