The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled Javascript Code
Posted by: Mark | May 10, 2011 @ 3:38am
Javascript Code
[
Download
]
// Simple JavaScript Rotating Banner Using jQuery // www.mclelun.com var jqb_vCurrent = 0; var jqb_vTotal = 0; var jqb_vDuration = 10000; var jqb_intInterval = 0; var jqb_vGo = 1; var jqb_vIsPause = false; var jqb_tmp = 20; var jqb_title; jQuery(document).ready(function() { jqb_vTotal = $(".jqb_slides").children().size() -1; $(".jqb_info").text($(".jqb_slide").attr("title")); jqb_intInterval = setInterval(jqb_fnLoop, jqb_vDuration); var $thumb_container = $(document.createElement('div')).addClass('jqb_thumb_container') $thumb_container.appendTo('.jqb_bar'); $("#jqb_object").find(".jqb_slide").each(function(i) { jqb_tmp = ((i - 1)*970) - ((jqb_vCurrent -1)*970); $(this).css("left", jqb_tmp+"px"); var thumb_url = $(this).find('img').attr('src'); var $thumb = $(document.createElement('div')).addClass('jqb_thumb').data('thumb_number', i).click(function(){ clearInterval(jqb_intInterval); jqb_vIsPause = true; $("#btn_pauseplay").removeClass("jqb_btn_pause").addClass("jqb_btn_play"); jqb_vCurrent = $(this).data('thumb_number') -1; jqb_fnLoop(); }); var $thumb_img = $(document.createElement('img')).attr({ src: thumb_url, width: 94, height: 46 }); $thumb_img.appendTo($thumb); $thumb.appendTo($thumb_container); }); $("#btn_pauseplay").click(function() { if(jqb_vIsPause){ jqb_fnChange(); jqb_vIsPause = false; $("#btn_pauseplay").removeClass("jqb_btn_play"); $("#btn_pauseplay").addClass("jqb_btn_pause"); } else { clearInterval(jqb_intInterval); jqb_vIsPause = true; $("#btn_pauseplay").removeClass("jqb_btn_pause"); $("#btn_pauseplay").addClass("jqb_btn_play"); } }); $("#btn_prev").click(function() { jqb_fnChange(); jqb_vGo = -1; }); $("#btn_next").click(function() { jqb_fnChange(); jqb_vGo = 1; }); }); function jqb_fnChange(){ clearInterval(jqb_intInterval); jqb_intInterval = setInterval(jqb_fnLoop, jqb_vDuration); jqb_fnLoop(); } function jqb_fnLoop(){ if(jqb_vGo == 1){ jqb_vCurrent == jqb_vTotal ? jqb_vCurrent = 0 : jqb_vCurrent++; } else { jqb_vCurrent == 0 ? jqb_vCurrent = jqb_vTotal : jqb_vCurrent--; } $("#jqb_object").find(".jqb_slide").each(function(i) { if(i == jqb_vCurrent){ jqb_title = $(this).attr("title"); $(".jqb_info").animate({ opacity: 'hide', "left": "-50px"}, 250,function(){ $(".jqb_info").text(jqb_title).animate({ opacity: 'show', "left": "0px"}, 500); }); } //Horizontal Scrolling jqb_tmp = ((i - 1)*970) - ((jqb_vCurrent -1)*970); $(this).animate({"left": jqb_tmp+"px"}, 1000); /* //Fade In & Fade Out if(i == jqb_vCurrent){ $(".jqb_info").text($(this).attr("title")); $(this).animate({ opacity: 'show', height: 'show' }, 500); } else { $(this).animate({ opacity: 'hide', height: 'hide' }, 500); } */ }); }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.43 / 8
200 Votes
http://codebin.yi.org/1262
page generated in 0.00 seconds