为什么这个jquery图像滑块不能与laravel @extends(' layouts.app')和@section(' content')一起使用

时间:2016-12-18 10:59:40

标签: javascript php jquery laravel-5

我在laravel中使用jquery图像滑块。它也在使用这个脚本

<!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">

            <meta name="description" content="jQuery Logo Slider Ticker by webdesignandsuch.com">
            <meta name="viewport" content="width=device-width, initial-scale=1"<script src="{{('http://code.jquery.com/jquery-latest.js')}}"></script>
            <script src="{{asset('js/jquery.bxSlider.js')}}"></script>
            <script type="text/javascript">
            $(document).ready(function(){
                $('#slider').bxSlider({
                ticker: true,
                tickerSpeed: 5000,
                tickerHover: true
            });
            });
            </script>

            <link href="{{asset('css/style.css')}}" rel="stylesheet">
    </head>

           <i><h2>Paper Articals</h2></i>
            <div class="slider-container">

        <ul id="slider">
            <li><a href="#"><p>kkkkkkk</p></li>
            <li><a href="#"><img src="{{asset('/imgs/2.jpg')}}"></a></li>
            <li><a href="#"><img src="{{asset('/imgs/3.jpg')}}"></a></li>
            <li><a href="#"><img src="{{asset('/imgs/4.jpg')}}"></a></li>
            <li><a href="#"><img src="{{asset('/imgs/5.jpg')}}"></a></li>
            <li><a href="#"><img src="{{asset('/imgs/6.jpg')}}"></a></li>
            <li><a href="#"><img src="{{asset('/imgs/7.jpg')}}"></a></li>
            <li><a href="#"><img src="{{asset('/imgs/8.jpg')}}"></a></li>
        </ul>

    </div><!-- /slider -->
    </html>

但是没有使用这个@extends(&#39; layouts.app&#39;) 在laravel中@section(&#39;内容&#39;)我正在使用5.2

@extends('layouts.app')
@section('content')

//above code here

@endsection 

没有错误但没有移动滑块保持它?怎么能解决它?

更新了app.blade.php

<!DOCTYPE html>
<html lang="en">
  <head>



    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="{{asset('favicon.ico')}}">

    <title>Wealth </title>

    <!-- Bootstrap core CSS -->
    <link href="{{asset('css/bootstrap.min.css')}}" rel="stylesheet">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="{{asset('css/ie10-viewport-bug-workaround.css')}}" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="{{asset('js/ie-emulation-modes-warning.js')}}"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- Custom styles for this template -->
    <link href="{{asset('css/carousel.css')}}" rel="stylesheet">




    <link href="{{asset('css/style.css')}}" rel="stylesheet">
  </head>
<!-- NAVBAR
================================================== -->
 <body>


     <div class="navbar-wrapper">
      <div class="container">

        <nav class="navbar navbar-default
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              <a class="navbar-brand" href=""><img src="{{asset('/imgs/logo.png')}}"></a>
                  {{--  <a class="navbar-brand" href="#">WEALTH LANKA MANAGEMENT</a>--}}
            </div>
            <div id="navbar" class="navbar-collapse collapse">
            {{-- <ul class="nav navbar-nav">--}}
            <ul class="nav navbar-nav navbar-right">
                <li class="active"><a href="">Home</a></li>
                 <li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">About<span class="caret"></span></a>
                  <ul class="dropdown-menu">
                    <li><a href="{{ url('/about') }}">About Us</a></li>
                    <li><a href="{{ url('/bod')}}">Boad of Ditectors</a></li>
                    <li><a href="{{ url('/st')}}">Senior Team</a></li>
                    {{-- <li role="separator" class="divider"></li>
                    <li class="dropdown-header">Nav header</li>
                    <li><a href="#">Separated link</a></li>
                    <li><a href="#">One more separated link</a></li>--}}
                  </ul>
                </li>
                <li><a href="{{ url('/services')}}">Services</a></li>
                <li><a href="{{ url('/contact')}}">Contact</a></li>

              </ul>
            </div>
          </div>
        </nav>

      </div>
  </div>
      <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    @yield('content')

  <script src="{{('http://code.jquery.com/jquery-latest.js')}}"></script>
    <script src="{{asset('js/jquery.bxSlider.js')}}"></script>
    <script type="text/javascript">
      $(document).ready(function(){
        $('#slider').bxSlider({
        ticker: true,
        tickerSpeed: 5000,
      tickerHover: true
      });
      });
    </script>


    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
    <script src="{{asset('js/bootstrap.min.js')}}"></script>
    <!-- Just to make our placeholder images work. Don't actually copy the next line! -->
    <script src="{{asset('js/vendor/holder.min.js')}}"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="{{asset('js/ie10-viewport-bug-workaround.js')}}"></script>
  </body>
</html>

1 个答案:

答案 0 :(得分:0)

app.blade.php

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="{{asset('favicon.ico')}}">
    <title>Wealth </title>
    <!-- Bootstrap core CSS -->
    <link href="{{asset('css/bootstrap.min.css')}}" rel="stylesheet">
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="{{asset('css/ie10-viewport-bug-workaround.css')}}" rel="stylesheet">
    <script src="{{asset('js/ie-emulation-modes-warning.js')}}"></script>
    <!-- Custom styles for this template -->
    <link href="{{asset('css/carousel.css')}}" rel="stylesheet">
    <!-- BxSlider css from library -->
    <link href="{{asset('css/jquery.bxslider.css')}}" rel="stylesheet">
    <link href="{{asset('css/style.css')}}" rel="stylesheet">
  </head>
  <body>
    <div class="navbar-wrapper">
      <div class="container">
        <nav class="navbar navbar-default">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              <a class="navbar-brand" href=""><img src="{{asset('/imgs/logo.png')}}"></a>
              {{--  <a class="navbar-brand" href="#">WEALTH LANKA MANAGEMENT</a>--}}
            </div>
            <div id="navbar" class="navbar-collapse collapse">
              {{-- <ul class="nav navbar-nav">--}}
              <ul class="nav navbar-nav navbar-right">
                <li class="active"><a href="">Home</a></li>
                <li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">About<span class="caret"></span></a>
                  <ul class="dropdown-menu">
                    <li><a href="{{ url('/about') }}">About Us</a></li>
                    <li><a href="{{ url('/bod')}}">Boad of Ditectors</a></li>
                    <li><a href="{{ url('/st')}}">Senior Team</a></li>
                    {{-- <li role="separator" class="divider"></li>
                    <li class="dropdown-header">Nav header</li>
                    <li><a href="#">Separated link</a></li>
                    <li><a href="#">One more separated link</a></li>--}}
                  </ul>
                </li>
                <li><a href="{{ url('/services')}}">Services</a></li>
                <li><a href="{{ url('/contact')}}">Contact</a></li>
              </ul>
            </div>
          </div>
        </nav>
      </div>
    </div>
    <!-- Content goes here -->
    @yield('content')

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="{{asset('js/jquery.bxSlider.js')}}"></script>
    <script type="text/javascript">
      $(document).ready(function(){
        if ($('#slider').length > 0) {
          $('#slider').bxSlider({
            ticker: true,
            tickerSpeed: 5000,
            tickerHover: true
          });
        }
      });
    </script>
    <script src="{{asset('js/bootstrap.min.js')}}"></script>
    <!-- Just to make our placeholder images work. Don't actually copy the next line! -->
    <script src="{{asset('js/vendor/holder.min.js')}}"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="{{asset('js/ie10-viewport-bug-workaround.js')}}"></script>
  </body>
</html>

otherpage.blade.php

@extends('layouts.app')
@section('content')
<ul class="bxslider">
  <li><img src="/images/pic1.jpg" /></li>
  <li><img src="/images/pic2.jpg" /></li>
  <li><img src="/images/pic3.jpg" /></li>
  <li><img src="/images/pic4.jpg" /></li>
</ul>
@endsection