简体   繁体   English

如何使用灯箱选项?

[英]How to use lightbox options?

How I can to use lightbox 2 options? 如何使用灯箱2选项? How to include in document? 如何包含在文件中? It does not work as specified on the site http://lokeshdhakar.com/projects/lightbox2/#options 它无法按照网站http://lokeshdhakar.com/projects/lightbox2/#options上的指定运行

<script>
    lightbox.option({
      'resizeDuration': 200,
      'wrapAround': true
    })
</script>


<a class="example-image-link" data-lightbox="example-set" href="pic.png">
  <img style="width: 100%" src="pic.png">
</a>

How do you set the lightbox options? 您如何设置灯箱选项?

Make sure you are including both the lightbox.js AND lightbox.css stylesheet. 确保同时包含lightbox.js lightbox.css样式表。

You will also need jQuery 1.7 or greater (as stated in step 4 of the Getting Started section of the Lightbox website ). 您还将需要jQuery 1.7或更高版本(如Lightbox网站“入门”部分的第4步中所述)。 You should include the jQuery script before the lightbox script. 您应该在灯箱脚本之前包含jQuery脚本。

This setup worked for me: 此设置对我有用:

<!DOCTYPE html>
<html>

<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.7.1/css/lightbox.css" />
<script src="jquery-1.11.3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.7.1/js/lightbox.min.js"></script>
</head>

<body>
<a class="example-image-link" data-lightbox="example-set" href="pic.png">
  <img style="width: 100%" src="pic.png">
</a>

<script>
lightbox.option({
  'resizeDuration': 200,
  'wrapAround': true
  })
</script>
</body>

</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM