开发者

Jquery: Slide up div if last

开发者 https://www.devze.com 2023-01-13 23:54 出处:网络
I have this friend request page, and i want my div echo \"<div style=\' font-weight: bold; background: #283b43; border-bottom: 1px dashed #719dab;\'>\";

I have this friend request page, and i want my div

echo "<div style=' font-weight: bold; background: #283b43; border-bottom: 1px dashed #719dab;'>";
echo "<img src='images/NewFriend_small.png' style='float: left; margin-left: 25px; margin-right: 10px;'>";
echo "Friend requests";
echo "</div>";

To disappear too if it's the last friend request the user have. Right now it doesnt do it, and only slide up the actual request (username, picture and so)

How should i check for if its the last friendrequest?

Right now its my code is like this

    $开发者_如何学编程friendsWaiting = mysql_query("SELECT * FROM users_friends where uID = '$v[id]' AND type = 'friend' AND accepted = '0'");
while($showW = mysql_fetch_array($friendsWaiting)){
echo "id: $showU[bID]";
}

JS when they accept/deny friend:

function MeYouFriendNB(confirm){
 var c = confirm ? 'confirm' : 'ignore';
var fID = $('#fID').val();

    $.ajax({ 
       type: "POST",
       url: "misc/AddFriend.php",
    data: {
    mode: 'ajax',
        friend: c,
    uID : $('#uID').val(),
    fID : $('#fID').val(),
        bID : $('#bID').val()
    },
       success: function(msg){
$('#friend'+fID).slideUp('slow');
$('#Friendlist').prepend(msg);
 $('#theNewFriend').slideDown('slow');
        }
     });
}


Use the :last selector in jQuery

http://api.jquery.com/last-selector/

$('div.friend:last').slideUp();

Is that what you were looking for?

0

精彩评论

暂无评论...
验证码 换一张
取 消