Advertisement
asimryu

app.js

Aug 23rd, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. $(".menu > ul > li").hover(
  2. function(){
  3. $(this).children("ul").slideDown();
  4. },
  5. function(){
  6. $(this).children("ul").slideUp();
  7. }
  8. );
  9.  
  10. var imgs = $("#slider > img");
  11. var max = imgs.length - 1;
  12. var sno = 0;
  13.  
  14. $("#slider").on("click",function(){
  15. $( imgs[sno] ).animate({
  16. left: "-100%",
  17. opacity: 1
  18. },1000,function(){
  19. $(this).css({
  20. left:"100%",
  21. opacity: 0
  22. });
  23. });
  24. sno++; //sno = sno + 1;
  25. if( sno > max ) sno = 0;
  26. $( imgs[sno] ).animate({
  27. left: "0",
  28. opacity: 1
  29. },1000);
  30. });
  31.  
  32. var timer = setInterval(function(){
  33. $("#slider").click();
  34. },2000);
  35.  
  36. var page = 1;
  37. function getlist(){
  38. $.get("list.php?page=" + page,function(data){
  39. $("#posts table tr:last").after(data);
  40. page++;
  41. });
  42. }
  43. getlist();
  44.  
  45. $(".btn-more").on("click",function(){
  46. getlist();
  47. });
  48.  
  49.  
  50. $(window).scroll(function() {
  51. if($(window).scrollTop() + $(window).height() == $(document).height()) {
  52. getlist();
  53. }
  54. });
  55.  
  56. $("#posts").on("click",".view-data",function(e){
  57. e.preventDefault();
  58. var id = $(this).attr("href");
  59. if( ! id ) return;
  60. $.getJSON("view.php?id=" + id, function(data){
  61. if( ! data ) return;
  62. $(".modal-title").text(data.title);
  63. $(".view-writer").text(data.writer);
  64. $(".view-date").text(data.created_at);
  65. $(".modal-content").text(data.content);
  66. $("#myModal").modal("show");
  67. });
  68.  
  69.  
  70.  
  71. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement