MattClark
03-14-2011, 01:48 PM
When I click the add as friend, I'm wanting the interactContainer to slide down, but it's not reacting to my clicks.
Here is the actual javascript
<script language="javascript" type="text/javascript">
//jQuery function for toggling add friend interaction container
function toggleInteractContainers(x) {
if($('#'+x).is(":hidden")) {
$('#'+x).slideDown(200);
}else {
$('#'+x).hide();
}
#('.interactContainers').hide();
}
</script>
here is the section of html that should be reacting to the javascript
<div class="addAsFriend"><?php echo $addAsFriend;?></div>
<div class="interactContainers" id="add_friend">
Add as a friend container
</div>
and here is the php
<?php
if(isset($_SESSION['user_id'])&& $_SESSION['user_id']!=$id) {
$addAsFriend ='<div><a href="#" onclick="return false" onmousedown="javascript:toggleInteractContainers(\'add_friend\');">Add as Friend</a>
</div>';
} else if(isset($_SESSION['user_id'])&& $_SESSION['user_id'] == $id) {
$addAsFriend ='<div>This is you</div>';
} else {
$addAsFriend = '<div><a href="signup.php">Sign Up</a> or <a href="login.php">Log In</a> to interact with ' . $first_name . ' ' . $last_name. '
</div>';
}
?>
Here is the actual javascript
<script language="javascript" type="text/javascript">
//jQuery function for toggling add friend interaction container
function toggleInteractContainers(x) {
if($('#'+x).is(":hidden")) {
$('#'+x).slideDown(200);
}else {
$('#'+x).hide();
}
#('.interactContainers').hide();
}
</script>
here is the section of html that should be reacting to the javascript
<div class="addAsFriend"><?php echo $addAsFriend;?></div>
<div class="interactContainers" id="add_friend">
Add as a friend container
</div>
and here is the php
<?php
if(isset($_SESSION['user_id'])&& $_SESSION['user_id']!=$id) {
$addAsFriend ='<div><a href="#" onclick="return false" onmousedown="javascript:toggleInteractContainers(\'add_friend\');">Add as Friend</a>
</div>';
} else if(isset($_SESSION['user_id'])&& $_SESSION['user_id'] == $id) {
$addAsFriend ='<div>This is you</div>';
} else {
$addAsFriend = '<div><a href="signup.php">Sign Up</a> or <a href="login.php">Log In</a> to interact with ' . $first_name . ' ' . $last_name. '
</div>';
}
?>