Stellar.js is malfunctioning

I've been attempting to implement a parallax effect using Stellar.js with two image tag elements, but I'm encountering issues. Despite trying various configurations, including following the Stellar.js creator's tutorial scripts closely, nothing seems to be working.

I have specified absolute and relative positioning for the images, set their sizes in pixels, added the data-stellar-background-ratio attribute, included all necessary jQuery and Stellar scripts, and searched exhaustively for a solution. However, I am still unable to get the desired result. While I may be new to jQuery, it appears that this should be a straightforward process based on available tutorials, yet it remains elusive.

If anyone could provide insight into what might be causing this problem, I would greatly appreciate it. Below are snippets of the relevant code:

<img src="images/header_Splash.png" width="886" height="478" alt="" id="headerSplash" data-stellar-background-ratio="1.25"/>

This snippet features one of the images intended for the parallax effect.

 </footer>

    <script src="jquery.min.js"></script>
    <script src="jquery.stellar.min.js"></script>
    <script src="script.pre.js"></script>

The above script links are located at the bottom of my HTML, just before the </html> tag.

$(function(){
$.stellar({
    horizontalScrolling: false,
    verticalOffset: 200
});

This code is extracted from the script.pre.js file, which I obtained from the Stellar.js tutorial site at

While I am aware of the numerous customizable options available through Stellar.js, my understanding is that such elaborate settings are unnecessary for a basic effect.

Could someone please point me in the right direction as to what might be the issue here?

Answer №1

When working with images, it is recommended to use the data-stellar-ratio attribute rather than data-stellar-background-ratio on your image tag.

The data-stellar-background-ratio should be reserved for elements that have a background-image style applied, like a div element.

For example: div { background-image: url("/img/circles.png"); }

In this scenario, the image should be considered as a scrollable element and not just a background image.

You can experiment by adding both attributes to any element with a background image to achieve unique visual effects.

Typically, images should only use the data-stellar-ratio attribute. An exception would be if you apply both attributes to a semi-transparent image with its own secondary background-image underneath.

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 ForEach function does not execute actions on every individual object, but rather only once

I am currently developing a Deck building application for a card game. In addition, I have set up a database to manage the cards that I sell and play with. The deck builder tool I created allows me to deplete the stock of sellable cards when adding them to ...

What is the best way to combine table cells in HTML to create a "T" shape?

Is there a way to merge the two blank cells (one above 'Be' and one above 'B') with a large blank space in the middle? I attempted using colspan and rowspan in various ways without success. https://i.stack.imgur.com/tw5SE.png This is m ...

Issue with form validation, code malfunctioning

I am struggling to figure out why this validation isn't working. Here is the HTML code I'm using: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type='text/javascript' src="scripts. ...

jQuery is attempting to create an animation by combining three variables to determine a new height

Currently, I am facing an issue with animating a div to a new height by summing up the heights of 3 other divs. Unfortunately, the heights do not seem to add up correctly, and I could really use some guidance on how to resolve this. Any suggestions or in ...

Suggestions for rectifying the calculation script to include the price, a phone number, 2 digits, and integrating a textfield for cost

I have developed a script that calculates prices, phone numbers, and extracts the last 2 digits from the phone number. In my website, the price is displayed through a select option. However, I am facing an issue where the cost does not automatically updat ...

Is there a way to shift a background image pattern?

After searching extensively, I came up empty-handed and am seeking guidance on how to achieve a specific effect. Specifically, I am in need of a JavaScript or jQuery script that can smoothly shift a background image to the right within a designated div con ...

What are the best practices for iterating through asynchronous generator functions?

Suppose we have an asynchronous generator: exports.asyncGen = async function* (items) { for (const item of items) { const result = await someAsyncFunc(item) yield result; } } Can we apply mapping to this generator? In essence, I am attempting ...

What could be hindering the activation of my button click event?

Below is the js file I am currently working with: var ButtonMaximizer = { setup: function () { $(this).click(function(){ console.log("The maximize button was clicked!"); }); } }; $(docum ...

What is the best way to add indentation to HTML code in a code tag?

Looking to insert some Python code into an HTML document using the code tag. Here is an example: <code> for iris, species in zip(irises, classification): if species == 0: print(f'Flower {iris} is Iris-setosa') </ ...

When collapsing an accordion, Bootstrap radio buttons fail to properly select

I have attempted various methods to achieve the desired functionality of having the accordion content close and open accordingly when checking a radio button, while also having the button visually appear as 'checked'. For a more in-depth example, ...

Filtering date ranges in two columns of Datatables

I am working on a table that contains two date columns. Currently, I have implemented a date range filter for one column (aData[3]) using the following code: $.fn.dataTableExt.afnFiltering.push( function(oSettings, aData, iDataIndex) { var dat ...

What is the process for dynamically setting @click in vue.js?

My array contains objects with methods as actions from a vue object. How can I dynamically set the @click event in a v-for loop? I attempted to use this.m1, "this.m1", "m1", but encountered an error: fns.apply is not a function. Javascript: new Vue ...

Loading background images in CSS before Nivo slider starts causing a problem

I've been struggling with preloading the background image of my wrapper before the nivo-slider slideshow loads. Despite it being just a fraction of a second delay, my client is quite particular about it -_- After attempting various jQuery and CSS tec ...

Guide to deploying a Next JS App with Mongoose for MongoDB connectivity on Vercel

I am experiencing issues when trying to deploy my Next.js app on Vercel with a MongoDB connection. I have added environment variables on the Vercel site where we deploy the Next.js app. Is there anything wrong in the following file? next.config.js module. ...

Transferring an HTML file to a destination stream

Currently, I'm in the process of constructing a proxy server. One of the tasks I'm tackling involves blocking specific URLs. I have developed a simple HTML page that is supposed to display whenever a blocked URL is requested, but unfortunately, ...

What is the best way to enable and disable the edit-in-place feature using jQuery?

Recently, I decided to experiment with the jQuery In Place Editor but I've come across an issue I can't seem to solve. Below is the code snippet that I have been working on. In my implementation, I am utilizing the jQuery toggle method to enable ...

Retrieving CSS file using admin-ajax.php in WordPress

The website has been tested on GTmetrix and you can view the report here I am puzzled as to why admin-ajax.php is causing a delay of over 3 seconds in loading time on this particular page that I am attempting to optimize. It seems to be related to a CSS ...

Maintaining Proper Header Dimensions

Having some issues with aligning my fixed widget and floating navigation. The fixed widget is not respecting the height of the floating navigation and is appearing at the top when in its fixed position. I'm currently using "Q2W3 Fixed Widget" for the ...

Simple 3-column grid design in HTML and CSS

My task is to design a 3-grid layout that resembles the following structure: ------------------------------------- | Image | The name of logo | > | ------------------------------------- I attempted this using the code below: <div class=" ...

Creating an interactive draggable box with jQuery-UI is as easy as pie

Is it possible to make the innerDropzone div draggable in the following code snippet? div.example { width: 560px; height: 750px; display: block; padding: 10px 20px; color: black; background: rgba(255, 255, 255, 0.4); -webkit-border ...