Using Jquery .each() function to hide images as another image is shown in the same class

ThatOneGuy

I am using the stellar.js to make a paralax site. I have images of feet set up to show at different points during scrolling. I am trying to write a function that will hide all other copies of the feet when one is shown. I can't change the stellar file itself to do this so I have to try and use an outside function:

//Feet on slide
$('.walkingFoot').each(function() {
    if ($(this).css('display') == 'block') {
        $('.walkingFoot').not(this).css('display','none');
    }   
});

All of the feet images in the set are in the .walkingFoot class. What I am trying to do is hide all other feet in the class when the display property is set to block. The code above does not seem to be working. Any help would be greatly appreciated.

Irvin Dominin

You can change your code in:

$('.walkingFoot').each(function () {
    if ($(this).is(":visible")) {
        $('.walkingFoot').not(this).hide();
    }
});

Demo: http://jsfiddle.net/IrvinDominin/2NEPY/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to show image on another image on click while there are multiple images with same class name using javascript or jquery?

jquery show hide using same class

Pass Image to another function within same class

How can I hide a class of DIV in a container and how another div in the same container? Using jQuery

Hide class if another span's child class is visible using jQuery

Change image with jquery using .toggle() in same function

Call JQuery function each time the page is shown

set each same class div background image from jquery array

How to hide element using Class; instead of using css function in JQuery?

Hide 'this' and another element using jquery

Using another function's output within the same class

View and Hide Image Using Jquery

JQuery - Hide a parent div that always has the same class IF it contains another div with another class that repeats itself that contains 2017

using-declaration in derived class does not hide same function derived from base class

Last image is not the same size as other images in that class

change image with Jquery - images over each other

can i show or hide in same class with jquery

Click image, hide other images and animate image sliding with JQUERY

jQuery Each function class toggling

calling php class function in another function of same class using call_user_func_array

Move each div with same class into another div

Same image taken using Cordova camera shown in different orientations

jQuery to show hide same class and hide previously open tag

show/hide images continuously 200ms each with jQuery

show and hide display with same class using javascript

Random background image for each div with the same class

How to hide all the divs of each class except first class in jquery

Using jQuery to change the same function where the class is class_01, class_02

Jquery append and modify each of same class