Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function()
- 9{
- 10 $('.wall-conteiner').WallSlider();
- 11});
- 12
- 13jQuery.fn.WallSlider = function()
- 14{
- 15 return this.each(function()
- 16 {
- 17 var conteiner = this;
- 18 var element = $('li:first', conteiner);
- 19 var date_temp = '';
- 20 var isAnimate = false;
- 21 var li_margin = parseInt($('li:first', conteiner).css('margin-top'));
- 22 $('.slide-bottom', conteiner).click(function()
- 23 {
- 24 var date = $('.wall-item:last').find('input').val();
- 25 var top = parseInt($('ul', conteiner).css('top'));
- 26 var last_li_offset = $('li:last', conteiner).offset().top;
- 27 var last_li_height = $('li:last', conteiner).innerHeight();
- 28 if ( ($(conteiner).innerHeight() - last_li_offset + ( last_li_height / 2 )) > 0)
- 29 {
- 30 return false;
- 31 }
- 32 if(date != date_temp)
- 33 {
- 34 $.post(wall_url, { date : date}, function(responce)
- 35 {
- 36 $('.wall-slider').append(responce);
- 37 });
- 38 }
- 39 date_temp = date;
- 40
- 41 if(!isAnimate)
- 42 {
- 43 isAnimate = true;
- 44 $('.wall-slider').animate({ top : top - (element.innerHeight() + li_margin) +'px' } , 200, '', function(){
- 45
- 46 element = element.next();
- 47 isAnimate = false;
- 48 });
- 49 }
- 50 });
- 51
- 52 $('.slide-top', conteiner).click(function()
- 53 {
- 54 var top = parseInt($('ul', conteiner).css('top'));
- 55 var first_li_height_half = $('li:first', conteiner).innerHeight() / 2;
- 56 //alert(top+' '+ first_li_height_half)
- 57 if( top >= 0 || (-top) < first_li_height_half) return false;
- 58 if(!isAnimate)
- 59 {
- 60 isAnimate = true;
- 61 element = element.prev();
- 62 $('.wall-slider').animate({ top : top + (element.innerHeight() + li_margin) +'px' } , 200, '', function(){
- 63 isAnimate = false;
- 64
- 65 });
- 66 }
- 67 });
- 68
- 69 });
- 70}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement