25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 

57 satır
2.1 KiB

  1. $(document).ready(function(){
  2. var hour_temp = "";
  3. var minute_temp = "";
  4. for(var i=0;i<24;i++){
  5. if(i<10){
  6. hour_temp += '<div class="select_hour">0'+i+'</div>'
  7. }else{
  8. hour_temp += '<div class="select_hour">'+i+'</div>'
  9. }
  10. }
  11. for(var i=0;i<60;i++){
  12. if(i<10){
  13. minute_temp += '<div class="select_minute">0'+i+'</div>'
  14. }else{
  15. minute_temp += '<div class="select_minute">'+i+'</div>'
  16. }
  17. }
  18. $(".select_hour_box").html(hour_temp);
  19. $(".select_hour_box").children().eq(0).addClass("select_option");
  20. $(".select_minute_box").html(minute_temp);
  21. $(".select_minute_box").children().eq(0).addClass("select_option");
  22. $(".select_hour").on("click",function(){
  23. var parent_height = $(".timepicker_select").offset().top;
  24. var this_height = $(this).offset().top;
  25. var scroll_height = $(".select_hour_box").scrollTop();
  26. var move_height = this_height - parent_height + scroll_height;
  27. $(".select_hour_box").animate({scrollTop:move_height},200);
  28. $(".select_hour_box").children().removeClass("select_option");
  29. $(this).addClass("select_option");
  30. var times = $(".select_hour_box").find(".select_option").text() + ':' + $(".select_minute_box").find(".select_option").text();
  31. $(".timepicker input").val(times);
  32. });
  33. $(".select_minute").on("click",function(){
  34. var parent_height = $(".timepicker_select").offset().top;
  35. var this_height = $(this).offset().top;
  36. var scroll_height = $(".select_minute_box").scrollTop();
  37. var move_height = this_height - parent_height + scroll_height;
  38. $(".select_minute_box").animate({scrollTop:move_height},200);
  39. $(".select_minute_box").children().removeClass("select_option");
  40. $(this).addClass("select_option");
  41. var times = $(".select_hour_box").find(".select_option").text() + ':' + $(".select_minute_box").find(".select_option").text();
  42. $(".timepicker input").val(times);
  43. });
  44. $(".timepicker_box").on("click",function(e){
  45. $(".timepicker_select").animate({
  46. height:'show'
  47. },200);
  48. e.stopPropagation();
  49. });
  50. });
  51. $(document).on("click",function(e){
  52. $(".timepicker_select").animate({
  53. height:'hide'
  54. },200);
  55. e.stopPropagation();
  56. });