topical media & game development
lib-jquery-plugin-news-jquery.accessible-news-slider.js / js
/*
----------------------------------------------------------------------------------------------------
Accessible News Slider
----------------------------------------------------------------------------------------------------
Author:
Brian Reindel
Author URL:
http://blog.reindel.com
License:
Unrestricted. This script is free for both personal and commercial use.
*/
jQuery.fn.accessNews = function( settings ) {
settings = jQuery.extend({
headline : "Top Stories",
speed : "normal",
slideBy : 2
}, settings);
return this.each(function() {
jQuery.fn.accessNews.run( jQuery( this ), settings );
});
};
jQuery.fn.accessNews.run = function( this ).css( "display", "none" );
var ul = jQuery( "ul:eq(0)", next = jQuery( ".next > a", back = jQuery( ".back > a", next.click(function() {
if ( !animating ) {
animating = true;
offsetLeft = parseInt( ul.css( "left" ) ) - ( liWidth * settings.slideBy );
if ( offsetLeft + ul.width() > 0 ) {
next.css( "display", "none" );
}
animating = false;
});
} else {
animating = false;
}
}
return false;
});
next.css( "display", "block" );
ul.animate({
left: offsetRight
}, settings.speed, function() {
if ( parseInt( ul.css( "left" ) ) == 0 ) {
next.css( "display", "block" )
.parent().after( [ "<p class=\"view_all\">", settings.headline, " - ", li.length, " total ( <a href=\"#\">view all</a> )</p>" ].join( "" ) );
jQuery( ".view_all > a, .skip_to_news > a", next.css( "display", "none" );
next.css( "display", "block" );
}
return false;
});
}
};
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.