2017-08-15 75 views
0

我试图在laravel中实现灯箱,但它不会从lightbox css文件中加载箭头(左,右...)。Fancybox我遇到了问题,当我单击在图像上,大小溢出了1,2秒,然后它出现在屏幕中心的正常大小(我有下图)。箭头路径public/lightbox/img。Lightbox无法在laravel应用程序中工作

下面是我的代码

default.blade.php

<title>My personal website</title> 
    <link rel="shortcut icon" href="{{ asset('favicon.png') }}" > 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 
    <link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"/> 
    <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"> 
    <link rel="stylesheet" href="{{ asset('css/style.css') }}" type="text/css"/> 
    <link rel="stylesheet" href="{{ asset('css/lightbox.css') }}" type="text/css"/> 

</head> 
<body> 

    <div class="container"> 
    <header> 
     @include('template.partial.nav') 
    </header> 
     @yield('content') 
    </div> 

    @include('template.partial.footer') 

    <!-- ***Scripts*** --> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 

    <!-- Add fancyBox --> 
    <script type="text/javascript" src="js/lightbox.min.js"></script> 

    <!-- Latest compiled and minified JavaScript --> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 

    <script type="text/javascript" src="{{ asset('js/test.js') }}"></script> 

</body> 
</html> 

portfolio.blade.php

@extends('template.default') 

@section('content') 
<div id="portfolio"> 
    <div class="row"> 
     <p class="heading">Portfolio</p> 
    </div> 
    <div class="row"> 
     <div class="col-md-12"> 
     <p class="subheading">Java application</p> 
     <hr> 
     <h2 style="text-align:center">Lightbox</h2> 
     <a data-lightbox="roadtrip" href="{{ asset('lightbox/img/demopage/rsz_java1.png') }}"> 
      <img src="{{ asset('lightbox/img/demopage/java1.png') }}" width="150" height="100"> 
     </a> 
     <a data-lightbox="roadtrip" href="{{ asset('lightbox/img/demopage/rsz_java1.png') }}"> 
      <img src="{{ asset('lightbox/img/demopage/java1.png') }}" width="150" height="100"> 
     </a> 
     </div> 
     </div> 

@endsection 

控制台错误:

portfolio:1 GET http://{projectname}/img/next.png 404 (Not Found) 
portfolio:1 GET http://{projectname}/img/close.png 404 (Not Found) 
portfolio:1 GET http://{projectname}/img/loading.gif 404 (Not Found) 
portfolio:1 GET http://{projectname}/img/prev.png 404 (Not Found) 

提前感谢! enter image description here

+0

你说箭头的images文件夹是public/lightbox/img。 但在你控制台错误的图像在public/img中搜索,所以你可以编辑lightbox.min.js中的路径或将文件夹public/lightbox/img移动到public/img –

+0

从css文件调用箭头,js文件使用css类。 –

+0

灯箱工作正常。唯一的问题是图像尺寸溢出,你可以从上面的图片看到。 –

回答

相关问题