jQuery - Not this or prev or next? -


how can select divs of class except 'this', , not next , previous div? code below selects except 'this':

$(".image-div").not(this).each(function() {             $(this).animate({                     width: '250px'                 }, 500, function() {                 // animation complete.             });         }        }); 

thanks

update - here full code:

$(".image-div").click(function () {       if ($(this).css('width') != '500px') {          $(this).animate({             width: '500px'             }, 500, function() {             // animation complete.         });          $(this).prev().animate({             width: '125px'             }, 500, function() {             // animation complete.         });          $(this).next().animate({             width: '125px'             }, 500, function() {             // animation complete.         });       } else {         $(this).animate({             width: '250px'             }, 500, function() {             // animation complete.         });     }       $(".image-div").not(this).each(function() {             $(this).animate({                     width: '250px'                 }, 500, function() {                 // animation complete.             });      });   }); 

all div.image-div's start out 250px wide. need when click on div, expands 500px , neighbors on both sides (also div.image-div's) shrink 125px.

when click on div again , neighbors re-size 250px. if click on div, divs (except clicked on div , neighbors) re-size 250px.

thanks

i changed little bit own understanding, should able figure out. it's sloppy, works.

var divclicked = $(this);  $(".image-div").not(divclicked).not($(".image-div").next()).not($(".image-div").prev()).each(function() {        $(this).css({              background: 'blue'        });  }); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -