手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jquery的幻灯片图片切换效果代码分享
jquery的幻灯片图片切换效果代码分享
摘要:本文实例讲述了jquery的幻灯片图片切换效果。分享给大家供大家参考。具体如下:这是一款基于jquery的幻灯片图片切换效果代码,有缩略图和...

本文实例讲述了jquery的幻灯片图片切换效果。分享给大家供大家参考。具体如下:

这是一款基于jquery的幻灯片图片切换效果代码,有缩略图和标题,可以自定义标题。

运行效果图: -------------------查看效果 下载源码-------------------

jquery的幻灯片图片切换效果代码分享1

小提示:浏览器中如果不能正常运行,可以尝试切换浏览模式。

(1)在head区域引入CSS样式:

<LINK rel=stylesheet type=text/css href="css/lrtk.css" charset=utf-8 media=screen>

(2)js代码:

<SCRIPT type=text/javascript src="js/jquery-1.3.2.min.js"></SCRIPT> <SCRIPT type=text/javascript src="js/jquery.easing.1.2.js"></SCRIPT> <SCRIPT type=text/javascript> // <![CDATA[ $(document).ready(function(){ if ($('#pager a').size() <= 1) { $('#pager').css('display', 'none'); return; } var index = 0; var selected = null; var width = 756; $('#pager a').each(function(i){ if (i == 0) { selected = $(this); selected.find('img').attr('src', 'images/button- view-active.gif'); } $(this).click(function(){ index = i; selected.find('img').attr('src', 'images/button- view.gif'); selected = $(this); selected.find('img').attr('src', 'images/button- view-active.gif'); $('#images').animate({left:-(width * i)}, 500, 'easeOutQuad'); return false; }); }); $('#images').wrapInner('<a href="#" id="next"></a>'); $('#next').click(function(){ var a = $('#pager a').get(index + 1); if (!a) a = $('#pager a').get(0); $(a).click(); return false; }); }); // ]]> </SCRIPT>

为大家分享的jquery的幻灯片图片切换效果代码如下

<head> <title>幻灯片图片切换效果</title> <LINK rel=stylesheet type=text/css href="css/lrtk.css" charset=utf-8 media=screen> <SCRIPT type=text/javascript src="js/jquery-1.3.2.min.js"></SCRIPT> <SCRIPT type=text/javascript src="js/jquery.easing.1.2.js"></SCRIPT> <SCRIPT type=text/javascript> // <![CDATA[ $(document).ready(function(){ if ($('#pager a').size() <= 1) { $('#pager').css('display', 'none'); return; } var index = 0; var selected = null; var width = 756; $('#pager a').each(function(i){ if (i == 0) { selected = $(this); selected.find('img').attr('src', 'images/button- view-active.gif'); } $(this).click(function(){ index = i; selected.find('img').attr('src', 'images/button- view.gif'); selected = $(this); selected.find('img').attr('src', 'images/button- view-active.gif'); $('#images').animate({left:-(width * i)}, 500, 'easeOutQuad'); return false; }); }); $('#images').wrapInner('<a href="#" id="next"></a>'); $('#next').click(function(){ var a = $('#pager a').get(index + 1); if (!a) a = $('#pager a').get(0); $(a).click(); return false; }); }); // ]]> </SCRIPT> </head> <body class=work-project> <DIV id=content> <DIV id=project><> <P id=navigation><SPAN id=pager> <A href="images/1.jpg"><IMG alt=1 src="images/button-view.gif" width=12 height=19></A> <A href="images/2.jpg"><IMG alt=2 src="images/button-view.gif" width=12 height=19></A> <A href="images/3.jpg"><IMG alt=3 src="images/button-view.gif" width=12 height=19></A> <A href="images/4.jpg"><IMG alt=4 src="images/button-view.gif" width=12 height=19></A> <A href="images/5.jpg"><IMG alt=5 src="images/button-view.gif" width=12 height=19></A> </SPAN></P> <> <DIV id=mask> <DIV id=images> <IMG src="images/1.jpg" width=756 height=518><IMG src="images/2.jpg" width=756 height=518><IMG src="images/3.jpg" width=756 height=518><IMG src="images/4.jpg" width=756 height=518><IMG src="images/5.jpg" width=756 height=518></DIV></DIV><> </DIV></DIV> </DIV> </body> </html>

以上就是为大家分享的jquery的幻灯片图片切换效果代码,希望大家可以喜欢,并应用到实践中。

【jquery的幻灯片图片切换效果代码分享】相关文章:

jQuery实现的多屏图像图层切换效果实例

jQuery实现div随意拖动的实例代码(通用代码)

精彩图片推荐 渐隐渐现

jQuery插件制作之全局函数用法实例

Javascript特效:随机显示图片的源代码

jQuery实现鼠标经过图片变亮其他变暗效果

jquery实现弹出层效果实例

jquery预加载图片的方法

onmousewheel event 缩放图片效果

js实现精美的图片跟随鼠标效果实例

精品推荐
分类导航