Jquery slide picture switching effect code sharing, jquery slide
This document describes how jquery performs slide picture switching. Share it with you for your reference. The details are as follows:
This is a jquery-based slide picture switching effect code with thumbnails and titles that can be customized.
Run: ------------------- view the download result source code -------------------
TIPS: If the browser cannot run properly, you can try to switch the browsing mode.
(1) Introduce CSS styles in the head area:
<LINK rel=stylesheet type=text/css href="css/lrtk.css" charset=utf-8 media=screen>
(2) js Code:
<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>
The jquery slide picture switching code is as follows:
<Head> <title> slide picture switching effect </title> <LINK rel = stylesheet type = text/css href = "css/lrtk.css" charset = UTF-8 media = screen> <SCRIPT type = text/javascript src = "javascript/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 '). size () <= 1) {comment ('{pager'}.css ('display', 'None'); return;} var index = 0; var selected = null; var width = 756; $ ('# pager '). 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 '). get (index + 1); if (! A) a = $ ('# pager '). get (0); $ (). click (); return false;}); //]> </SCRIPT>
The above is the jquery slide picture switching effect code shared for you. I hope you will like it and apply it to practice.