Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function(){
- $(".item").hover(
- function() {
- $(".bottom", this)
- .stop()
- .animate({height: 330 + "px", top: 0 + "px", opacity: 1});
- },
- function() {
- $(".bottom", this)
- .stop()
- .animate({height: 0 + "px", top: 330 + "px", opacity: 0});
- });
- $(".next").click(function(e){
- doSlide("next", this);
- e.preventDefault();
- });
- $(".prev").click(function(e){
- doSlide("prev", this);
- e.preventDefault();
- });
- var doSlide = function(direction, button) {
- next = $(".next"),
- prev = $(".prev"),
- slideWrap = $(button).nextAll('.slide-wrap'),
- slideWidth = $('.item').outerWidth(),
- slideScroll = slideWrap.position().left - slideWidth;
- if (direction == "next") {
- if( next.attr('name') == 'next' ) {
- next.removeAttr('name');
- slideWrap.stop().animate({left: slideScroll}, 500, function(){
- slideWrap
- .find(".item:first")
- .appendTo(slideWrap)
- .parent()
- .css({'left': 0});
- });
- setTimeout(function(){ next.attr('name','next') }, 600);
- }
- } else if (direction == "prev") {
- if( prev.attr('name') == 'prev' ) {
- prev.removeAttr('name');
- slideWrap
- .css({'left': slideScroll})
- .find('.item:last')
- .prependTo(slideWrap)
- .parent()
- .stop()
- .animate({left: 0}, 500);
- setTimeout(function(){ prev.attr('name','prev') }, 600);
- }
- }
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement