如何使用javascript在灯箱中显示图像? [英] How can I show an image in lightbox using javascript?

查看:57
本文介绍了如何使用javascript在灯箱中显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个vb.net项目。

MS Visual Studio 2008

框架:3.5

DB:MSSQL SERVER 2005



我需要在网站的主页(默认)页面上使用javascript在灯箱中显示图像。例如:当用户点击该网站时,首先自动向他/她显示一个灯箱,该灯箱将在网页的主页(默认)页面加载图像。



现在,我有两个文件,一个是jquery.lightbox.min.js,另一个是jquery.lightbox.css。



图像大小:宽度X高度= 400 X 550 JPG格式



在< head>下标签:

< script type =text / javascriptsrc =js / lightbox / jquery.lightbox.min.js>< / script>



< link rel =stylesheettype =text / csshref =js / lightbox / themes / default / jquery.lightbox.css/>





现在,请建议我,我将如何进一步处理?



什么我试过了:



< html>

< head>

< link rel =stylesheettype =text / csshref =js / lightbox / themes / default / jquery.lightbox.css/>

< script type =text / javascript src =js / lightbox / jquery.lightbox.min.js>< / script>

< script type =text / javascript>

jQuery(document).ready(function($){

$('。lightbox')。lightbox();

});

< / script>

< / head>



< body>

I'm working on a vb.net project.
MS Visual Studio 2008
Framework: 3.5
DB: MSSQL SERVER 2005

I need to show an image in lightbox using javascript on home(default) page of the website. For ex: when an user hit to the website then firstly automatically show him/her a lightbox which will have an image on page load of home(default) page of the website.

Now, I have two files, one is "jquery.lightbox.min.js" and other is "jquery.lightbox.css".

Image size: width X height = 400 X 550 in JPG format

Under <head> tag:
<script type="text/javascript" src="js/lightbox/jquery.lightbox.min.js"></script>

<link rel="stylesheet" type="text/css" href="js/lightbox/themes/default/jquery.lightbox.css" />


Now, please suggest me, how would i do further process?

What I have tried:

<html>
<head>
<link rel="stylesheet" type="text/css" href="js/lightbox/themes/default/jquery.lightbox.css" />
<script type="text/javascript" src="js/lightbox/jquery.lightbox.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$('.lightbox').lightbox();
});
</script>
</head>

<body>



< img src =img / JP-and-McGW.jpgwidth =400p xheight =550pxalt =title =/>


<img src="img/JP-and-McGW.jpg" width="400px" height="550px" alt="" title="" />



< / body>

< / html>


</body>
</html>

推荐答案

){


('。lightbox')。lightbox() ;

});

< / script>

< / head>



< body>

('.lightbox').lightbox();
});
</script>
</head>

<body>


< img src =img / JP-and-McGW.jpgwidth = 400pxheight =550pxalt =title =/>


<img src="img/JP-and-McGW.jpg" width="400px" height="550px" alt="" title="" />



< / body>

< / html>


</body>
</html>


这篇关于如何使用javascript在灯箱中显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆