The CSS styles on pages dynamically adjust as new content loads with the use of Infinite Scroll functionality

I am facing an issue with my site that has Infinite Scroll, Isotope, and .mb_miniplayer_play audio player. Whenever a new page is loaded in, the CSS on previously loaded pages changes for one element only. Despite trying different solutions, I can't seem to get all the pages to display and function correctly.

Below is the code snippet:

**//Audio jquery**

$(function AudioEvents(){

$(".audio").mb_miniPlayer({
width:210,
height:34,
inLine:false,
onEnd:playNext
});

var $audios = $('.audio');

function playNext(idx) {
var actualPlayer=$audios.eq(idx),
$filteredAtoms = $container.data('isotope').$filteredAtoms,
isotopeItemParent = actualPlayer.parents('.isotope-item'),
isoIndex = $filteredAtoms.index( isotopeItemParent[0] ),
nextIndex = ( isoIndex + 1 ) % $filteredAtoms.length;

$filteredAtoms.eq( nextIndex ).find('.audio').mb_miniPlayer_play();
}



**//Inifinite Scroll**

var $container = $('#container');

$container.isotope({
itemSelector : '.square'
});

$container.infinitescroll({
navSelector  : '#page_nav',    // selector for the paged navigation 
nextSelector : '#page_nav a',  // selector for the NEXT link (to page 2)
itemSelector : '.square',     // selector for all items you'll retrieve
loading: {
    finishedMsg: 'No more pages to load.',
    img: 'http://i.imgur.com/qkKy8.gif'
  }
},

// call Isotope as a callback
  function( newElements ) {
  var $newElements = $(newElements);

  AudioEvents( $newElements );

  // add hover events for new items
  bindSquareEvents( $newElements );

  setTimeout(function() {
  $container.isotope('insert', $newElements );
  }, 1000);
  });
});

Has anyone encountered this issue? It seems like there might be a mistake or something missing in my jQuery code, but I'm not sure what it is.

Here is the HTML markup... The problematic div is .download. The CSS settings for 'Top' on the loaded pages need top:-114 for proper appearance, while newly loaded pages only require top:-24 for correct display.

<div class="square techno">

<!-- DJ Picture -->
<img src="Pictures/dirtyharris.jpg" class="img1" />
        <div class="boxtop">
        <span class="genre">Techno</span>
        </div>

        <div class="box">
        <a class="close" href="#close">&times;</a>
        <!-- DJ Name -->
        <h1> ThreeSixty & Dirty Harris</h1>

        <!-- Song Title -->
        <h2>Louka (Funkagenda Re-Edit)</h2>

         <!--Song Description(179 characters with spaces)-->
        <h4>I had to include this one since it literally took over control of me while driving the other morning. I was bouncing around in my seat like a little kid who desparately needs to use the bathroom. </h4> 

            <div class="buttons">
            <!--Song file info-->
            <div class="player">
            <a id="m85" class="audio {skin:'#010101',showVolumeLevel:false,showTime:false,showRew:false,ogg:'MP3/Adrian Lux feat. The Good Natured - Alive (Extended Mix).ogg'}" href="MP3/Adrian Lux feat. The Good Natured - Alive (Extended Mix).mp3"></a></div>


                <!--Download Link-->
                <div class="download">
                <a href="MP3/ThreeSixty, Funkagenda - Loudka (Funkagenda Re-Edit).mp3" title='Right Click and Save Link As'>
                <img src="img/dlicon.png"/></a>

                </div>
            </div>
        </div>

</div>

Answer №1

There appears to be no CSS modifications in your jQuery code. CSS is not inherently dynamic and does not adjust styling on its own according to different pages. It can be altered through jQuery or PHP, but this seems to be missing here.

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

Working with AngularJS to Create Repeated Divs and Buttons

Currently, I'm looking to utilize ng-repeat to iterate over a div that contains a button. At the moment, I am achieving this by generating the div and button in the JavaScript section and then adding the final outcome to an array: var newDiv = docum ...

What is the reason for the input type number in the <input> field being passed as a string?

I am currently developing a straightforward component that allows the user to input the balance they wish to add. Here is the template used for taking input from the user: <h3>Add Balance:</h3> <input #payment type="number"> < ...

Utilize a dynamic URL within the HTML audio element

Currently, I am working with the use of the audio tag in HTML and AngularJS. I need to specify the source of the audio file I want to play, as shown below. <audio src="http://localhost/audio/221122/play/212223.mp3" audio player controls p ...

Styling Html.ActionLink is not supported

I'm struggling to style my links properly when combining CSS and Bootstrap with MVC. It seems like @Html.ActionLink is needed for redirection, but styling remains a challenge. Is there a way to style it effectively? When using pure CSS, everything wo ...

What is the best way to conceal text while retaining icons on a compact screen?

How can I hide the text links for Home, Reservations, My Reservations, About, and Settings on smaller screens while still keeping the icons visible? Currently, I am using the following resources: http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.1 ...

What could be causing my AJAX request to send a null object to the server?

I'm currently working on an ajax request using XMLHttpRequest, but when the processRequest method is triggered, my MVC action gets hit and all object property values come up as null. Ajax Class import {Message} from "./Message"; export class AjaxHe ...

Organizing Results into Divs Based on Column Value Using AngularJs

I've been racking my brain trying to figure out the best way to organize and display my results in separate divs, specifically using Bootstrap col-md-4's. This is for a chat messaging app that I'm in the process of developing. I have rooms a ...

The equal height feature in Bootstrap 4's card-deck is not functioning as expected

I am having an issue with the card-deck property where it is not being applied correctly. The .card-deck class should create a grid of cards that are equal in height and width, and the layout should adjust automatically as more cards are added. Here is th ...

Techniques for simulating functions in Jest

I have a pair of basic components that I'm currently creating tests for using jest. My goal is to verify that when I click on a currencyItem, the corresponding array gets added to the select state. To achieve this, I am passing the handleCurrencyToggl ...

Is HTML5 data-target used for loading pages?

Currently, I am working with some HTML5 code: <li class="tile google" data-target-activation="click" data-target="loading"> <div> <a href="#">Search Google</a> <h2>Google</h2> </div> </li> Upon ...

Display or hide a div element when hovering over it, while also being able to select the text within

I am trying to display and conceal a tooltip when hovering over an anchor. However, I want the tooltip to remain visible as long as my cursor is on it. Here is the fiddle link $('#showReasonTip').mouseover(function(){ $(this).parent().find(&apo ...

Tips for executing an SQL query containing a period in its name using JavaScript and Node.JS for an Alexa application

Hello there, I've been attempting to make Alexa announce the outcomes of an SQOL query, but I'm encountering a persistent error whenever I try to incorporate owner.name in the output. this.t("CASEINFO",resp.records[0]._fields.casenumber, resp.r ...

The use of Bootstrap carousel indicators effectively controls event propagation

One way to achieve the desired effect is by implementing a solution like the one provided in this example from Bootstrap. When interacting with the indicators quickly, the animations can stack on top of each other, resulting in a strange chain of events. ...

Tips for avoiding race conditions causing errors in API calls

Struggling to make an axios.get call and store the returned data in a const named movies within the component state. Unfortunately, it seems like the API call is failing as the movies const remains empty. This issue causes another function that depends o ...

Deactivate the form outside of normal business hours

I need to create a form for a delivery service that only operates from 9am to 9pm. If a user submits the form outside of these hours, I want to redirect them to a page displaying the company's operating hours instead of a thank you page. For instance ...

Enhancing Donut Chart with d3.js

After working for several hours, I'm having trouble getting my d3.js donut graph to update with new data. Here's my HTML: <body> <div id="pie"></div> <script src="pie.js"></script> </body> And he ...

Achieving the functionality of keeping the search query box and alphabetical search options visible on the page even after performing a search and displaying the results can be done by

I have set up a PHP page with search query field and alphabetical search options. When submitting the query, the results are displayed on the same page; however, I would like the results to show in the same location as the alphabetical search. Currently, ...

Warning: Be cautious of ReactJS errors

While developing my first application using ReactJS, I encountered a warning message when running my code: Warning: Failed form propType: You have provided a checked prop to a form field without an onChange handler. This will result in a read-only field ...

Issue with countdown timer when making modifications on my website utilizing Angular and TypeScript

I implemented a countdown timer in typescript on the homepage of my website. However, when I navigate to another page, I encounter a console error every second. .TS countDown() { var countDownDate = new Date("Jan 1, 2022 00:00:00").getTime ...

JavaScript User Information Lookup Module

My goal: I am trying to create a function that will check if the firstName provided matches an existing contact's firstName in the contacts array, and if the prop specified is a valid property of that contact. If both conditions are met, the functio ...