2013-12-09 3 views
0

Bootstrap Lightbox의 데모 버전으로 작업 중이며, 웹 개발도 처음입니다. 라이트 박스가 작동하지 않을 수 있습니다.이 경우 첫 번째 이미지 인 shell_small.jpg는 눈에 잘 띄고 링크가 명확하지만 클릭하면 주목할만한 유일한 변경 사항은 http://127.0.0.1:52595/index.html에서 http://127.0.0.1:52595/index.html#demoLightbox으로 이동하지만 페이지는 그대로 유지된다는 것입니다. 똑같다. 아무도 무슨 일이 일어나고 있는지 설명 할 수 있습니까?부트 스트랩 라이트 박스가 나타나지 않습니다.

<!DOCTYPE html> 
<html> 
    <head> 
    <title>Bootstrap 101 Template</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <!-- Bootstrap --> 
     <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css"> 
     <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-lightbox/0.6.1/bootstrap-lightbox.css"> 
     <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-lightbox/0.6.1/bootstrap-lightbox.js"> 
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> 
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> 
    <!--[if lt IE 9]> 
     <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> 
     <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> 
    <![endif]--> 
    </head> 
    <body> 
    <a data-toggle="lightbox" href="#demoLightbox" class="thumbnail"> 
     <img src="shell_small.jpg" alt="Click to view the lightbox"> 
    </a> 
    <div id="demoLightbox" class="lightbox hide fade" tabindex="-1" role="dialog" aria-hidden="true"> 
     <div class='lightbox-content'> 
      <img src="image.png"> 
      <div class="lightbox-caption"><p>Your caption here</p></div> 
     </div> 
    </div> 

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> 
    <script src="https://code.jquery.com/jquery.js"></script> 
    <!-- Include all compiled plugins (below), or include individual files as needed --> 
    <script src="js/bootstrap.min.js"></script> 
    </body> 
</html> 

답변

2

문제는 jQuery 전에 라이트 박스 플러그인을로드하고 있다는 것입니다. jQuery 코드 뒤에 머리글 또는 라이트 박스 코드를 넣으십시오. 두 번째로 라이트 박스 코드를 스타일 시트로로드하고 있습니다.

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> 
    <script src="https://code.jquery.com/jquery.js"></script> 
    <!-- Include all compiled plugins (below), or include individual files as needed --> 
    <script src="js/bootstrap.min.js"></script> 
    <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-lightbox/0.6.1/bootstrap-lightbox.js"></script> 
    </body> 
</html> 

을 머리에서

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-lightbox/0.6.1/bootstrap-lightbox.js"> 

을 제거 :

은 이런 식으로 작업을 수행합니다.

+0

잘 변경되었지만 아무 것도 변경되지 않은 것 같습니다. – EasilyBaffled

+0

콘솔에 오류 메시지가 표시됩니까? – idmean

+1

서버에서이 파일을 테스트하고 있습니까? 그렇지 않다면'//cdnjs.cloudflare.com/ajax/libs/bootst...'을'http : //cdnjs.cloudflare.com/ajax/libs/bootst ...' – idmean

관련 문제