2016-11-29 71 views
0

我想使用燈箱,但我做到了,但無法使用。 我嘗試了一切。好的版本,末尾標籤上的腳本等。 包括:lightbox.css,lightbox.js,jquery-1.7.2.js 我沒有看到圖標,但我看到它們在那裏。 當我在頭部的jquery後有lightbox.js時,它仍然不起作用。 我覺得我有很好的路徑。沒有圖標的燈箱

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl"> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" /> 
    <meta name="Description" content="blablabla" /> 
    <meta name="Keywords" content="blablabla" /> 
    <title>blablabla</title> 
    <link href="https://fonts.googleapis.com/css?family=Lato:400,700,900&amp;subset=latin-ext" rel="stylesheet"> 
    <link rel="stylesheet" href="indexStyle.css" type="text/css"/> 
    <link href="lightbox.css" rel="stylesheet"> 
    <script type="text/javascript" src="jquery-1.7.2.js"></script> 
    <script type="text/javascript" src="lightbox.js"></script> 
    <script type="text/javascript" src="banner.js"></script> 

</head> 
<body onload="zmienslajd();"> 
<div class="backgroundContainer"> 
    <div class="container"> 
     <div class="upContainer"> 
      <div class="logo"> 
       <a href="blablabla"><img src="models/logo.png" alt="Przepraszamy - awaria logo." /></a> 
      </div> 
      <div class="nav"> 
       <ol> 
        <li><a href="blablabla2"></a></li> 
        <li><a href="#">Oferta</a></li> 
        <li><a href="blablabla3">Gallery</a></li> 
        <li><a href="blablabla4"></a></li> 
       </ol> 
      </div> 
     </div> 
     <div style="clear: both"></div> 
     <div id="banner"> 

     </div> 
     <div style="clear: both"></div> 
     <div class="midContainer"> 
      <a href="Models/galeria1.jpg" data-lightbox="roadtrip"><img src="Models/mingaleria1.jpg" alt="Zdjęcie 1"></a> 
      <a href="Models/galeria2.jpg" data-lightbox="roadtrip"><img src="models/mingaleria2.jpg" alt="Zdjęcie 2"></a> 
      <a href="Models/galeria3.jpg" data-lightbox="roadtrip"><img src="models/mingaleria3.jpg" alt="Zdjęcie 3"></a> 
      <a href="Models/galeria4.jpg" data-lightbox="roadtrip"><img src="models/mingaleria4.jpg" alt="Zdjęcie 4"></a> 
      <script type="text/javascript" src="lightbox.js"></script> 
     </div> 
     <div style="clear: both"></div> 
     <div class="botContainer"> 
      Time4Fruit.pl &copy; 2016 by blablabla 
     </div> 
     <div style="clear: both"></div> 
    </div> 
</div> 
<script type="text/javascript" src="lightbox.js"></script> 
</body> 
</html> 

我的CSS:

/* Preload images */ 
body:after { 
    content: url("images/close.png") url("images/loading.gif") url("images/prev.png") url("images/next.png"); 
    display: none; 
} 
body.lb-disable-scrolling { 
    overflow: hidden; 
} 
.lightboxOverlay { 
    position: absolute; 
    top: 0; 
    left: 0; 
    z-index: 9999; 
    background-color: black; 
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); 
    opacity: 0.8; 
    display: none; 
} 
.lightbox { 
    position: absolute; 
    left: 0; 
    width: 100%; 
    z-index: 10000; 
    text-align: center; 
    line-height: 0; 
    font-weight: normal; 
} 
.lightbox .lb-image { 
    display: block; 
    height: auto; 
    max-width: inherit; 
    max-height: none; 
    border-radius: 3px; 
    /* Image border */ 
    border: 4px solid white; 
} 
.lightbox a img { 
    border: none; 
} 
.lb-outerContainer { 
    position: relative; 
    *zoom: 1; 
    width: 250px; 
    height: 250px; 
    margin: 0 auto; 
    border-radius: 4px; 
    /* Background color behind image. 
    This is visible during transitions. */ 
    background-color: white; 
} 
.lb-outerContainer:after { 
    content: ""; 
    display: table; 
    clear: both; 
} 
.lb-loader { 
    position: absolute; 
    top: 43%; 
    left: 0; 
    height: 25%; 
    width: 100%; 
    text-align: center; 
    line-height: 0; 
} 
.lb-cancel { 
    display: block; 
    width: 32px; 
    height: 32px; 
    margin: 0 auto; 
    background: url("images/loading.gif") no-repeat; 
} 
.lb-nav { 
    position: absolute; 
    top: 0; 
    left: 0; 
    height: 100%; 
    width: 100%; 
    z-index: 10; 
} 
.lb-container > .nav { 
    left: 0; 
} 
.lb-nav a { 
    outline: none; 
    background-image: url('data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='); 
} 
.lb-prev, .lb-next { 
    height: 100%; 
    cursor: pointer; 
    display: block; 
} 
.lb-nav a.lb-prev { 
    width: 34%; 
    left: 0; 
    float: left; 
    background: url("images/prev.png") left 48% no-repeat; 
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); 
    opacity: 0; 
    -webkit-transition: opacity 0.6s; 
    -moz-transition: opacity 0.6s; 
    -o-transition: opacity 0.6s; 
    transition: opacity 0.6s; 
} 
.lb-nav a.lb-prev:hover { 
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); 
    opacity: 1; 
} 
.lb-nav a.lb-next { 
    width: 64%; 
    right: 0; 
    float: right; 
    background: url("images/next.png") right 48% no-repeat; 
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); 
    opacity: 0; 
    -webkit-transition: opacity 0.6s; 
    -moz-transition: opacity 0.6s; 
    -o-transition: opacity 0.6s; 
    transition: opacity 0.6s; 
} 
.lb-nav a.lb-next:hover { 
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); 
    opacity: 1; 
} 
.lb-dataContainer { 
    margin: 0 auto; 
    padding-top: 5px; 
    *zoom: 1; 
    width: 100%; 
    -moz-border-radius-bottomleft: 4px; 
    -webkit-border-bottom-left-radius: 4px; 
    border-bottom-left-radius: 4px; 
    -moz-border-radius-bottomright: 4px; 
    -webkit-border-bottom-right-radius: 4px; 
    border-bottom-right-radius: 4px; 
} 
.lb-dataContainer:after { 
    content: ""; 
    display: table; 
    clear: both; 
} 
.lb-data { 
    padding: 0 4px; 
    color: #ccc; 
} 
.lb-data .lb-details { 
    width: 85%; 
    float: left; 
    text-align: left; 
    line-height: 1.1em; 
} 
.lb-data .lb-caption { 
    font-size: 13px; 
    font-weight: bold; 
    line-height: 1em; 
} 
.lb-data .lb-caption a { 
    color: #4ae; 
} 
.lb-data .lb-number { 
    display: block; 
    clear: left; 
    padding-bottom: 1em; 
    font-size: 12px; 
    color: #999999; 
} 
.lb-data .lb-close { 
    display: block; 
    float: right; 
    width: 30px; 
    height: 30px; 
    background: url("images/close.png") top right no-repeat; 
    text-align: right; 
    outline: none; 
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70); 
    opacity: 0.7; 
    -webkit-transition: opacity 0.2s; 
    -moz-transition: opacity 0.2s; 
    -o-transition: opacity 0.2s; 
    transition: opacity 0.2s; 
} 
.lb-data .lb-close:hover { 
    cursor: pointer; 
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); 
    opacity: 1; 
} 
+0

爲什麼你要加載腳本?嘗試將每個JS腳本移動到頁面底部,在''結束標記 –

+0

之前,最有可能文件路徑不正確。 – kayee

+0

我認爲路徑是正確的。我檢查了它。塞巴斯蒂安Kaczmarek任何錯誤,但只是我看到警告數據燈箱,說明:屬性數據 - 燈箱不允許在這裏。 此檢查將未知的HTML標記屬性強調爲無效,並且可以將這些屬性標記爲自定義以避免突出顯示它們爲無效。如何解決這個警告? –

回答

0

解決。
<link href="lightbox.css" rel="stylesheet">是錯誤的。
應該是:

<link href="css/lightbox.css" rel="stylesheet" type="text/css"/> 

UFF。現在是正確的!

+0

這是正確的,當我有3個文件:js與lightbox.ja,CSS與lightbox.css和圖像的圖標。 –