开发者

jquery local scroll issues

I have a social network that has custom made comments section for users. Users are also able to reply to comments. Each comment has a 'reply' button that when pressed, uses jquery to make a new text box structure appear.

It is a bit lengthy in syntax and logic so I am a bit lost on what the problem may be ( it is not functioning at all. I have also run out of trouble shoot methods.

Here is the code for the comments and replies:

<div id="x_comment_box">
                <form name="x_comment_form" method="post" action="Project-X.php">
                    <textarea name="comment_body" class="round_10px defaulted">Leave a comment about "Name of Video"...</textarea>
                    <input type="submit" name="x_submit" value="Submit" class="post"/>
                </form>
            </div>
            <?php   
            $query = "SELECT * FROM `x_comments` WHERE `status` = 'active' ORDER BY `date` DESC, `time` DESC LIMIT 10";
            $request = mysql_query($query,$connection) or die(mysql_error());
            while($result = mysql_fetch_array($request)) {
            $webcast_poster = new User($result['userID']);
            $body = $result['commentBody'];
            $date = $result['date'];
            $time = $result['time'];
            $comment_id = $result['id'];
            ?>

                <div class="comment_structure_future_webcast_x clearfix">
                    <a name="comment_<?php echo $result['id']; ?>"></a>
                    <div class='comment_polaroid_future'>
                        <a href='http://www.cysticlife.org/Profile.php?id=<?php echo $poster->id ?>'>
                            <img src='<?php echo $webcast_poster->img('mini'); ?>' border='0'/>
                        </a>
                    </div>
                    <div class='comment_body_future_webcast_x round_10px'>
                        <div id='CommentNameProfile'>
                                <a href='http://www.cysticlife.org/Profile.php?id=<?php echo $auth->id; ?>'>
                                    <?php echo $webcast_poster->first_name. " ". $webcast_poster->last_name; ?> says...
                                </a>
                        </div>
                        <?php echo strip_tags(stripslashes(nl2br($result['commentBody'])),'<br><br />'); ?>

                        <div id='CommentInfoProfile'>
                            <?php echo date('M d, Y',strtotime($result['date'])); ?> at <?php echo date('g:i A',strtotime($result['time'])); ?> &bull; 
                            <?php if($webcast_poster->id == $auth->id) { ?>
                                <a href=开发者_StackOverflow中文版'#' onclick='confirmation("DeleteWebcastComment.php?id=<?php echo $result['id']; ?>&ret=<?php echo urlencode($_SERVER['REQUEST_URI']); ?>");'>Delete &bull;</a> 
                            <?php } ?>
                            <a href='#reply_form_<?php echo $result['id']; ?>' name='reply_to_<?php echo $result['id']; ?>' class='reply_link'>Reply</a>
                        </div>
                    </div>
                    <div class='profile_comment_tail_future'>&nbsp;</div>

                </div>
            <?php }?>
                <?php
                /* responses */ 
                $query = "SELECT 
                                * 
                            FROM 
                                `x_comments_replies` 
                            WHERE 
                                `commentID` = '" . $result['id'] . "' 
                                && `status` = 'active' 
                                ORDER BY `date` ASC, `time` ASC";
                $request2 = mysql_query($query,$connection);
                while($reply = mysql_fetch_array($request2)) { 
                $replier = new User($reply['replierID']);
                ?>

                <div class="response_structure_future">
                    <a name="response_<?php echo $reply['id']; ?>"></a>
                    <div class="response_polaroid_future">
                        <a href="http://www.cysticlife.org/Profile.php?id=<?php echo $replier->id; ?>">
                        <img src="<?php echo $replier->img('mini'); ?>" /> 
                        </a>
                    </div>

                    <div class="response_body_future round_10px">
                        <div class="response_arrow_future"></div>
                        <div class="response_tail_future"></div>
                        <div class="response_data_future">
                            <div class="response_name_future">
                                <a href="http://www.cysticlife.org/Profile.php?id=<?php echo $replier->id; ?>">
                                <?php echo $replier->first_name . " " . $replier->last_name; ?> says...
                                </a>
                            </div>
                            <?php echo strip_tags(stripslashes(nl2br($reply['comment'])),'<br><br />'); ?>
                            <div class="response_info_future">
                                <?php echo date('M d, Y',strtotime($reply['date'])); ?> at <?php echo date('g:i A',strtotime($reply['time'])); ?>
                                <?php if($auth->id == $replier->id || $auth->id == $result['ToUserID']) { ?>
                                <a onclick="confirmation('DeleteAirwaveReply.php?id=<?php echo $reply['id']; ?>&ret=<?php echo urlencode($_SERVER['REQUEST_URI']); ?>');"> &bull; delete</a>
                                <?php } ?>
                                <div id="thumb_holder_replies">
                                    <div id="thumb_report_replies">
                                        <a href="mailto:info@cysticlife.org">
                                            report
                                        </a>
                                    </div>
                                    <div  class= "thumb_counter_replies" id="thumb_counter_replies_<?php echo $reply['id']; ?>">
                                    +<?php echo $reply['thumbsUp_reply']; ?>
                                    </div>
                                    <div id="thumb_thumb_replies">

                                        <?php $comment_reply_id = $reply['id'];?>
                                    <a class="myButtonLink" href="Profile_test.php?id=<?php echo $prof->id; ?>" id="<?php echo $comment_reply_id; ?>">Vote Up!</a>

<?php echo $replier->id; ?>
<?php print_r($replier->id); ?>
<?php echo $result['id']; ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <?php } ?>

                <a name='reply_form_<?php echo $result['id']; ?>' style="clear:both"></a>
                <div id='reply_to_<?php echo $result['id']; ?>' class="respond_structure_future" <?php if(isset($_GET['reply_to']) && $_GET['reply_to'] == $result['id']) { echo 'style="display:block;"';}else{ echo 'style="display:none;"';} ?>>
                    <div class="respond_polaroid_future">
                        <a href="http://www.cysticlife.org/Profile.php?id=<?php echo $auth->id; ?>">
                            <img src="<?php echo $auth->img('mini'); ?>" />
                        </a>
                    </div>                              
                    <form name='comment_reply' action='<?php echo $_SERVER['REQUEST_URI']; ?>' method='post'>
                        <div class="respond_body_future round_10px">
                            <div class="respond_arrow_future"></div>
                            <div class="respond_tail_future"></div>
                            <div class="respond_data_future">
                                <textarea id="reply_to_<?php echo $result['id']; ?>_textarea" name='reply'></textarea><br />
                                <input type='hidden' name='comment' value='<?php echo $result['id']; ?>' />
                                <div class="respond_nevermind">
                                    <a href="reply_to_<?php echo $result['id']; ?>">nevermind</a>
                                </div>
                                <input type='submit' class="submit" name='sub_comment_reply' value='Reply' />
                            </div>
                        </div>
                    </form>
                </div>

Here is the jquery:

<script type="text/javascript">
$(document).ready( function() {
    $('#Comments').localScroll({ offset:{top:-40,left:0} });
    $("a.reply_link").click( function() {
        $("#"+$(this).attr('name')).fadeIn('slow');
    });

    $(".respond_nevermind a").click( function(event) {
        event.preventDefault();
        var reply_box = document.getElementById($(this).attr('href'));
        $(reply_box).css('display','none');

        var reply_textarea = document.getElementById($(this).attr('href')+"_textarea");
        $(reply_textarea).val('');
    });
});
</script>

thanks in advance

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜