videosearch.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // 头部搜索 ----------------------------------------
  2. $('.seekinput_search span').on('mousemove',function(){ //显示切换框
  3. $('.seekinput_option').show();
  4. })
  5. $('.seek_box').on('mouseleave',function(){ //隐藏切换框
  6. $('.seekinput_option').hide();
  7. })
  8. $('.seekinput_option span').eq(1).attr('class','on'); //默认
  9. $('.seekinput_search input[qhid="2"]').show(); //默认
  10. $('.seekinput_option span').on('click',function(){
  11. $('.seekinput_search input[type="text"]').hide();
  12. var _html = $(this).html();
  13. $('.seekinput_search span i').html(_html);
  14. $('.seekinput_option').hide();
  15. $(this).attr('class','on').siblings().attr('class','');
  16. var _qhid = $(this).attr('qhid');
  17. $('.seekinput_search input[qhid="'+_qhid+'"]').show(); //选中的搜索输入框
  18. $('.seek_input input[type="button"]').attr('buttonid',_qhid); //选中的 类型 1为 楼盘列表 2为 视频列表
  19. $('.seekinput_search input[type="text"]').val(""); //清空input 内容
  20. })
  21. $('.seek_input input[type="button"]').on('click',function(){ //搜索跳转操作
  22. var _buttonid = $(this).attr('buttonid');
  23. var txt = $('.seek_input input[qhid="'+_buttonid+'"]').val();
  24. console.log(_buttonid);
  25. console.log(txt);
  26. if (txt != '') {
  27. switch(_buttonid)
  28. {
  29. case '1':
  30. window.open('/house/search?name='+ txt);
  31. break;
  32. case '2':
  33. window.location.href = '/video/videosearch?name='+ txt;
  34. break;
  35. }
  36. };
  37. })
  38. $(document).keydown(function(event){
  39. if(event.keyCode==13){
  40. $('.seek_input input[type="button"]').click();
  41. }
  42. });
  43. // 头部搜索 ----------------------------------------
  44. // 获取 "video" 视频元素时长
  45. $(function(){
  46. function myFunction(cid){
  47. cid.each(function(){
  48. var _this=$(this)
  49. _this.find('video.video_list_main')[0].addEventListener("loadedmetadata", function(){
  50. var tol = this.duration;//获取总时长
  51. var time = parseInt(tol);
  52. var minutes = parseInt(time / 60);
  53. var seconds =( time - minutes * 60);
  54. _this.find('.time_b').html(Appendzero(minutes)+':'+Appendzero(seconds))
  55. })
  56. })
  57. }
  58. function Appendzero (obj) { //时间补零
  59. if (obj < 10) return "0" + obj; else return obj;
  60. }
  61. myFunction($('.videosearch_box ul li'));
  62. });