jay stephens jay stephens - 8 months ago 82
CSS Question

Moving a div after another has been moved using if statement

I basically have a set of notifications stacked in a list which each can be removed individually, thus sliding out of the notification container.



function(){ $('.alert1').css({left: '500px'}) }



When a notification is closed, whether it's the first or the fifth, I need to notifications that haven't been removed to rise to the top of the container to fill the space that the now removed notification had left.

I've tried using something like this which didn't seem to work

if( $(".alert1").css('left') == '500px') {



If anyone could give me some advice, I've attempted to use the first code above but It generally only works if someone closed them in the order of 1-2-3-4 rather than someone closing them like 2-1-4-3.



Its simple. Just add to all alerts same class "removableAlert" and remove it this way:

$(function() {
  $(".removableAlert").click(function() {
    $(this).animate({left: "+=500"}, 400).slideUp();