lundi 30 janvier 2017

Who can I automatically scroll to bottom of page on load in laravel

I want to scroll to bottom of the page on page-load automatically in laravel 5.2, i tried soo much but i couldn't figure out were i went wrong, I have attached my view code below.Can u go through it please and let me know were i went wrong. Actually i'm not good at design soo please help me on it.

my code:

 @section('content')
        <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="col-md-3 col-sm-6 col-xs-12 profile_left">
                <!-- start Support Tickets -->
                <ul class="list-unstyled user_data">
                    <li>
                        <div class="panel panel-success">
                            <div class="panel-heading"><span class="glyphicon glyphicon-filter"></span><strong>&nbsp;&nbsp; Ticket Information</strong></div>
                            <div class="panel-body">
                                <!-- Modal -->
                                <table class="table table" style="color: #009933;">
                                    @if(!empty($tickets))
                                        <tr>
                                            <td style="font-weight: bold; ">
                                                <small>
                                                    &nbsp;
                                                </small>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="font-weight: bold;  ">
                                                <small>
                                                    @if ($tickets->status === 'open')
                                                        <span class="label label-success"></span>
                                                    @elseif ($tickets->status === 'ongoing')
                                                        <span class="label label-warning"></span>
                                                    @elseif ($tickets->status === 'closed')
                                                        <span class="label label-default"></span>
                                                    @endif
                                                </small>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="font-weight: bold;  ">
                                                <small>
                                                    <p style="font-family: 'Times New Roman', Times, serif; ">Agent:&nbsp;</p>
                                                </small>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="font-weight: bold;  ">
                                                <small>
                                                    <p style="font-family: 'Times New Roman', Times, serif; ">Priority:&nbsp;
                                                        @if ($tickets->priority === 'Low')
                                                            <span class="label label-info"></span>
                                                        @elseif ($tickets->priority === 'Medium')
                                                            <span class="label label-primary"></span>
                                                        @elseif ($tickets->priority === 'High')
                                                            <span class="label label-danger"></span>
                                                        @endif</p>
                                                </small>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="font-weight: bold;  ">
                                                <small>
                                                   <p style="font-family: 'Times New Roman', Times, serif; ">Last_Updated:&nbsp;</p>
                                                </small>
                                            </td>
                                        </tr>
                                    @endif
                                </table>
                            </div>
                        </div>
                    </li>

                    <li>
                        <div class="panel panel-success">
                            <div class="panel-heading">
                                <span class="glyphicon glyphicon-dashboard"></span><strong>&nbsp;&nbsp; Support</strong>
                            </div>
                            <div class="panel-body">
                                <!-- Modal -->
                                <table class="table table-striped">
                                    <tr>
                                        <td><span class="glyphicon glyphicon-home"></span>&nbsp;<a href = '/view' style="text-decoration:none">My Support Tickets</a></td>
                                    </tr>
                                    <tr>
                                        <td><span class="glyphicon glyphicon-open"></span>&nbsp;<a href = '/openticket' style="text-decoration:none">Submit Tickets</a></td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </li>
                </ul>
                <!-- end of Support Tickets -->
            </div>

            <div class="col-md-9 col-sm-9 col-xs-12">
                <center>
                    <h2 style="color: #00BCD4;">My Ticket Feedback/<small>Your Comments History</small></h2>
                </center>
                <hr style="height:2px;border-width:0;color:gray;background-color:gray">
                @if($tickets->status === 'closed')
                    @if(Auth::user()->_id === $tickets->user)
                        <div class="alert alert-warning" role="alert">
                            <center>
                                <p style="font-weight: bold; color:#FF9966; ">This Ticket is closed. You can reply to reopen this ticket.</p>
                            </center>
                        </div>

                        <div class="panel panel-success">
                            <div class="panel-heading">
                                <form action = "/reopentick/<?php echo $tickets->id; ?>" method = "post">
                                    <input type = "hidden" name = "_token" value = "<?php echo csrf_token(); ?>">
                                    <input type="hidden" name="ticket_id" value="<?php echo $tickets->id; ?>">
                                    <input type="hidden" name="status" value="open">
                                    <span class="glyphicon glyphicon-pencil"></span>
                                    <input type = 'submit' value = "Reply To Reopen Ticket"  class="btn btn-link btn-xs" style="font-weight: bold; color:#009933; " />
                                    <span class="glyphicon glyphicon-plus pull-right"></span>
                                </form>
                            </div>
                        </div>
                    @endif
                @endif

                <table class="table table-striped">
                    <tr><td>
                            <div class="panel-group">
                                @if($tickets->user == Auth::user()->_id)
                                    <div class="panel panel-info">
                                        @else
                                            <div class="panel panel-success">
                                                @endif
                                                <div class="panel-heading">
                                                 <span class="glyphicon glyphicon-user">
                                                     <strong>
                                                       
                                                     </strong>
                                                 </span>
                                                    <span class="glyphicon glyphicon-time pull-right">
                                                    </br>
                                                </span>
                                                </div>
                                                <div class="panel-body">
                                                    <p> Hello,</br>
                                                        {!! $tickets->message !!}</br>
                                                        <b>...</b></br>
                                                        Thank you,</br>
                                                        
                                                    </p>
                                                </div>
                                            </div>
                                    </div>
                        </td></tr>
                    <tr>
                        @foreach($anstickets as $t)
                            <td class="answer_block">
                                <div class="panel-group">
                                    @if($t->user_id == Auth::user()->_id)
                                        <div class="panel panel-info">
                                            @else
                                                <div class="panel panel-success">
                                                    @endif
                                                    <div class="panel-heading">
                                                <span class="glyphicon glyphicon-user ">
                                                    <strong>
                                                       
                                                    </strong>
                                                </span>
                                                        <span class="glyphicon glyphicon-time pull-right">
                                                    </br>
                                                </span>
                                                    </div>
                                                    <div class="panel-body">
                                                        <p>Hi,</p>
                                                        {!!$t->comments!!}</br>
                                                    </div>
                                                </div>
                                        </div>
                            </td>
                    </tr>
                    @endforeach
                </table>

                @if(($tickets->status === 'ongoing')||($tickets->status === 'open'))
                    @if(Auth::user()->_id === $tickets->user)
                        <div class="panel  panel-danger">
                            <div class="panel-heading">
                                <form action = "/closetick/<?php echo $tickets->id; ?>" method = "post" >
                                    <input type = "hidden" name = "_token" value = "<?php echo csrf_token(); ?>">
                                    <input type="hidden" name="ticket_id" value="<?php echo $tickets->id; ?>">
                                    <input type="hidden" name="status" value="closed">
                                    <input type = 'submit' value = "Close Ticket"  class="btn btn-link btn-xs" style="font-weight: bold; color:#CC0000; "/>
                                    <span class="glyphicon glyphicon-remove-sign pull-right"></span>
                                </form>
                            </div>
                        </div>
                    @endif

                    <br>
                        @if(Auth::user()->_id === $tickets->user)
                            <b><h1> Response</h1></b>
                        @else
                            <b><h1> Solution</h1></b>
                        @endif
                    <form action = "/tickanswert/<?php echo $tickets->id; ?>" method = "post" onsubmit="return form_submit()">
                        <input type = "hidden" name = "_token" value = "<?php echo csrf_token(); ?>">
                        <input type="hidden" name="user_id" value="<?php echo Auth::user()->id; ?>">
                        <input type="hidden" name="ticket_id" value="<?php echo $tickets->id; ?>">
                        <div class="form-group">
                            <textarea class="form-control" name="comments" rows="14" required></textarea>
                        </div>
                        <br>
                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit"  name="submit" class="btn btn-primary btn-lg">
                                    <i class="fa fa-btn fa-ticket"></i> SUBMIT
                                </button>
                            </div>
                        </div>
                    </form>
                @endif
            </div>
        </div>

    @endsection
    @section('additional-scripts')
        <script>
            $( document ).ready(function() {
                $('html,body').animate({
                            scrollTop: $('.answer_block').children('.panel-group').last().offset().top},
                        'slow');
                alert("Hello! I am an alert box!!");
            });


        </script>

    @endsection



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire