function mymarquee(box) { var box = $(box) var slider = box.find('.slider') var li = slider.find('li') var prev = box.find('.prev') var next = box.find('.next') var bheight = box.outerheight() var theight = slider.outerheight() + 10 if (theight > bheight) { box.addclass('isscroll') settimeout(function() { var tclone = li.clone(true) slider.append(tclone) }, 1000) var topvalue = 0 var timer function marquee() { timer = setinterval(function() { if (math.abs(topvalue) >= theight) { topvalue = topvalue + theight } slider.css({ top: topvalue-- }) }, 20) } marquee() box.mouseenter(function() { clearinterval(timer) }) box.mouseleave(function() { marquee() }) prev.click(function() { if (topvalue + 100 <= 0) { topvalue += 100 } else { topvalue = 0 } slider.stop().animate({ top: topvalue }, 500) }) next.click(function() { if (math.abs(topvalue - 100) >= theight * 2 - bheight) { topvalue = bheight - theight * 2 } else { topvalue -= 100 } slider.stop().animate({ // top: topvalue - 100, top: topvalue }, 500) // topvalue -= 100 }) } else { box.removeclass('isscroll') } } function myslider(box) { var box = $(box) var slider = box.find('.slider') var li = slider.find('li') var prev = box.find('.prev') var next = box.find('.next') box.addclass('isscroll') prev.click(function() { var active = slider.find('.active') var currentindex = active.index() if (currentindex > 0) { var currenttop = active.position().top var currentheight = active.prev().outerheight() + 10 var topvalue = currenttop - currentheight slider.stop().animate({ top: -topvalue }, 1000, function() { li.eq(currentindex - 1).addclass('active').siblings().removeclass('active') }) } }) next.click(function() { var active = slider.find('.active') var currentindex = active.index() var currenttop = active.position().top var currentheight = active.outerheight() + 10 var boxheight = box.outerheight() var slideheight = slider.outerheight() var topvalue = currenttop + currentheight if (topvalue + boxheight > slideheight) { slider.stop().animate({ top: boxheight - slideheight }, 1000) } else { slider.stop().animate({ top: -topvalue }, 1000, function() { li.eq(currentindex + 1).addclass('active').siblings().removeclass('active') }) } }) } function ajax(url, id) { var ajax = $.ajax({ url: url, async: false, data: { id: id } }); $("#list-show").html(ajax.responsetext); }; function ajaxval(url, id, val) { var ajax = $.ajax({ url: url, async: false, data: { id: id, val: val } }); // $('.ajax-search input').val(''); $("#list-show").html(ajax.responsetext); };