简单lightbox的javascript似乎无法正常工作

简单lightbox的javascript似乎无法正常工作,javascript,youtube,lightbox,Javascript,Youtube,Lightbox,不幸的是,我是编程新手,为了帮助我,我一直在youtube上学习一些简单的教程(除了学习树屋课程)。我一直在努力解决的一个问题,似乎找不到解决方案,就是构建一个简单的lightbox,让click事件打开lightbox。我检查了所有的行,语法,是否省略了一个;或者{},我想可能我的javascript src不正确,尝试下载,创建一个js文件夹并链接到该文件夹,引用谷歌托管的javascript,检查firebug,尝试不同的浏览器,检查CSS是否正确(这似乎与将显示设置为阻止时一样,它看起来

不幸的是,我是编程新手,为了帮助我,我一直在youtube上学习一些简单的教程(除了学习树屋课程)。我一直在努力解决的一个问题,似乎找不到解决方案,就是构建一个简单的lightbox,让click事件打开lightbox。我检查了所有的行,语法,是否省略了一个;或者{},我想可能我的javascript src不正确,尝试下载,创建一个js文件夹并链接到该文件夹,引用谷歌托管的javascript,检查firebug,尝试不同的浏览器,检查CSS是否正确(这似乎与将显示设置为阻止时一样,它看起来正常),我想可能有更新的语法规则(我尝试了jQuery而不是$,但就是看不出我在哪里出错。可能我遗漏了一些非常简单的东西,所以请事先原谅我。我下面的youtube链接是:我也检查了视频的评论,看看是否有其他人有同样的问题,有些人有,但大多数人似乎都没有问题,没有发布解决方案。)对于那些没有得到它的工作

请参阅以下代码:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script type="text/javascript">

jQuery(document).ready(function(){

    jQuery('.lightbox').click(function(){
        jQuery('.backdrop, .box').animate({'opacity':'.50'}, 300, 'linear'); //fades in the backdrop and the lightbox - speed of 300, and displayed in a linear fashion. Only want the backdrop displayed with 50% opacity, and the box at 100% (see below line)
        jQuery('.box').animate({'opacity':'1.00'}, 300, 'linear');
        jQuery('.backdrop, .box').css('dispaly', 'block'); //sets the appearance of the box
    }); 

});


</script>

jQuery(文档).ready(函数(){
jQuery('.lightbox')。单击(函数(){
jQuery('.background,.box').animate({'opacity':'.50'},300,'linear');//在背景和lightbox中淡入淡出-速度为300,并以线性方式显示。只希望背景以50%的不透明度显示,而长方体以100%的透明度显示(见下一行)
jQuery('.box').animate({'opacity':'1.00'},300,'linear');
jQuery('.background,.box').css('dispaly','block');//设置框的外观
}); 
});
非常感谢您,感谢您提供的宝贵资源!
Nic

Lightbox是一种JavaScript技术,用于使用模式对话框显示图像和其他web内容,其中图像显示在屏幕的大部分中央,窗口的其余部分变暗。Lightbox最初是特定JavaScript插件的名称。然而,该术语的常用用法已演变为包含Lightbox-一般来说,为JavaScript插件和效果设置样式

首先,我们拍摄一些图像(当我们点击图像时,灯箱会显示出来)

HTML代码:

       <section id="examples" class="examples-section">
          <div class="container">

                 <h3 style="clear: both;">Four image set</h3>

                 <div class="image-row">
                       <div class="image-set">
                              <a class="example-image-link" href="img/demopage/image-3.jpg" data-lightbox="example-set" data-title="Click the right half of the image to move forward."><img class="example-image" src="img/demopage/thumb-3.jpg" alt=""/></a>
                              <a class="example-image-link" href="img/demopage/image-4.jpg" data-lightbox="example-set" data-title="Or press the right arrow on your keyboard."><img class="example-image" src="img/demopage/thumb-4.jpg" alt="" /></a>
                              <a class="example-image-link" href="img/demopage/image-5.jpg" data-lightbox="example-set" data-title="The next image in the set is preloaded as you're viewing."><img class="example-image" src="img/demopage/thumb-5.jpg" alt="" /></a>
                              <a class="example-image-link" href="img/demopage/image-6.jpg" data-lightbox="example-set" data-title="Click anywhere outside the image or the X to the right to close."><img class="example-image" src="img/demopage/thumb-6.jpg" alt="" /></a>
                       </div>
                 </div>
          </div>
   </section>

四图像集

现在为screen和lightbox添加css代码文件。还可以下载lightbox.js和jquery库java脚本文件。

lightbox是一种JavaScript技术,用于使用模式对话框显示图像和其他web内容,其中图像显示在屏幕的大部分中央,其余窗口变暗。lightbox最初是特定JavaScript插件的名称。然而,该术语的常用用法已经演变为包含Lightbox样式的JavaScript插件和效果

首先,我们拍摄一些图像(当我们点击图像时,灯箱会显示出来)

HTML代码:

       <section id="examples" class="examples-section">
          <div class="container">

                 <h3 style="clear: both;">Four image set</h3>

                 <div class="image-row">
                       <div class="image-set">
                              <a class="example-image-link" href="img/demopage/image-3.jpg" data-lightbox="example-set" data-title="Click the right half of the image to move forward."><img class="example-image" src="img/demopage/thumb-3.jpg" alt=""/></a>
                              <a class="example-image-link" href="img/demopage/image-4.jpg" data-lightbox="example-set" data-title="Or press the right arrow on your keyboard."><img class="example-image" src="img/demopage/thumb-4.jpg" alt="" /></a>
                              <a class="example-image-link" href="img/demopage/image-5.jpg" data-lightbox="example-set" data-title="The next image in the set is preloaded as you're viewing."><img class="example-image" src="img/demopage/thumb-5.jpg" alt="" /></a>
                              <a class="example-image-link" href="img/demopage/image-6.jpg" data-lightbox="example-set" data-title="Click anywhere outside the image or the X to the right to close."><img class="example-image" src="img/demopage/thumb-6.jpg" alt="" /></a>
                       </div>
                 </div>
          </div>
   </section>

四图像集

现在为screen和lightbox添加css代码文件。还可以下载lightbox.js和jquery库java脚本文件。

lightbox是一种JavaScript技术,用于使用模式对话框显示图像和其他web内容,其中图像显示在屏幕的大部分中央,其余窗口变暗。lightbox最初是特定JavaScript插件的名称。然而,该术语的常用用法已经演变为包含Lightbox样式的JavaScript插件和效果

首先,我们拍摄一些图像(当我们点击图像时,灯箱会显示出来)

HTML代码:

       <section id="examples" class="examples-section">
          <div class="container">

                 <h3 style="clear: both;">Four image set</h3>

                 <div class="image-row">
                       <div class="image-set">
                              <a class="example-image-link" href="img/demopage/image-3.jpg" data-lightbox="example-set" data-title="Click the right half of the image to move forward."><img class="example-image" src="img/demopage/thumb-3.jpg" alt=""/></a>
                              <a class="example-image-link" href="img/demopage/image-4.jpg" data-lightbox="example-set" data-title="Or press the right arrow on your keyboard."><img class="example-image" src="img/demopage/thumb-4.jpg" alt="" /></a>
                              <a class="example-image-link" href="img/demopage/image-5.jpg" data-lightbox="example-set" data-title="The next image in the set is preloaded as you're viewing."><img class="example-image" src="img/demopage/thumb-5.jpg" alt="" /></a>
                              <a class="example-image-link" href="img/demopage/image-6.jpg" data-lightbox="example-set" data-title="Click anywhere outside the image or the X to the right to close."><img class="example-image" src="img/demopage/thumb-6.jpg" alt="" /></a>
                       </div>
                 </div>
          </div>
   </section>

四图像集

现在为screen和lightbox添加css代码文件。还可以下载lightbox.js和jquery库java脚本文件。

lightbox是一种JavaScript技术,用于使用模式对话框显示图像和其他web内容,其中图像显示在屏幕的大部分中央,其余窗口变暗。lightbox最初是特定JavaScript插件的名称。然而,该术语的常用用法已经演变为包含Lightbox样式的JavaScript插件和效果

首先,我们拍摄一些图像(当我们点击图像时,灯箱会显示出来)

HTML代码:

       <section id="examples" class="examples-section">
          <div class="container">

                 <h3 style="clear: both;">Four image set</h3>

                 <div class="image-row">
                       <div class="image-set">
                              <a class="example-image-link" href="img/demopage/image-3.jpg" data-lightbox="example-set" data-title="Click the right half of the image to move forward."><img class="example-image" src="img/demopage/thumb-3.jpg" alt=""/></a>
                              <a class="example-image-link" href="img/demopage/image-4.jpg" data-lightbox="example-set" data-title="Or press the right arrow on your keyboard."><img class="example-image" src="img/demopage/thumb-4.jpg" alt="" /></a>
                              <a class="example-image-link" href="img/demopage/image-5.jpg" data-lightbox="example-set" data-title="The next image in the set is preloaded as you're viewing."><img class="example-image" src="img/demopage/thumb-5.jpg" alt="" /></a>
                              <a class="example-image-link" href="img/demopage/image-6.jpg" data-lightbox="example-set" data-title="Click anywhere outside the image or the X to the right to close."><img class="example-image" src="img/demopage/thumb-6.jpg" alt="" /></a>
                       </div>
                 </div>
          </div>
   </section>

四图像集

现在为screen和lightbox添加css代码文件。还要下载lightbox.js和jquery库java脚本文件。

dispaly
应该是
display
非常感谢您的回复!不幸的是,这个愚蠢的错误没有修复,我已经写了好几次代码来确保,所以我有点不好意思我犯了这样一个错误!我再次运行了拼写检查,没有其他这样的错误,我很有信心这次…
dispaly
应该是
display
非常感谢您的回复!不幸的是,这是