标签:
//格式化为时间字符串 yyyy-mm-dd hh:mm:ss function strDate(date, type) { var y = date.getFullYear(), m1 = date.getMonth() + 1, d = date.getDate(); var h = date.getHours(), m2 = date.getMinutes(), s = date.getSeconds(); var str = ‘‘; switch (type) { case ‘y-m-d‘: str = y + ‘-‘ + m1 + ‘-‘ + d; break; case ‘h:m‘: str = h + ‘:‘ + m2; break; default: str = y + ‘-‘ + m1 + ‘-‘ + d + ‘ ‘ + h + ‘:‘ + m2 break; } console.log(str); return str; } strDate(new Date(1419580954141)); // 带有data-validate=‘number‘的input只能输入数字 $(document).on("input", "input[data-validate=‘number‘]", function () { $(this).val($(this).val().replace(/[^0-9]/g, ‘‘)); }); function changeTimeFormat(time) { time = parseInt(time); var date = new Date(time); var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1; var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); var hh = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(); var mm = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); var ss = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds(); return date.getFullYear() + "-" + month + "-" + currentDate + " " + hh + ":" + mm + ":" + ss; } var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i) ? true : false; }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i) ? true : false; }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i) ? true : false; }, Windows: function() { return navigator.userAgent.match(/IEMobile/i) ? true : false; }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Windows()); } }; if( isMobile.any() ) { $(‘.video-hd-panel‘).hide(); $(‘.carousel-pos‘).css(‘overflow‘,‘hidden‘); }
标签:
原文地址:http://www.cnblogs.com/jiangtuzi/p/4330142.html