123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- $(function(){
- var t1 = null;//这个设置为全局
- var myScroll;
- //输入框快速删除初始化
- mui(".mui-input-row input").input();
- /*滚动区域事件*/
- myScroll = new IScroll(".iscroll",{
- scrollbars: true,
- fadeScrollbars:true,
- scrollbars: 'custom',
- shrinkScrollbars:'clip',
- });
- /*滚动区域的刷新事件*/
- setTimeout(function () {
- $("body").height(document.body.scrollHeight);
- myScroll.refresh();
- }, 100);
- $(".lisBtn").click(function(){
- $(".ar_header").css("z-index","1");
- $("nav").css("z-index","1");
- $(".dangan_iscroll").css("z-index","1");
- $(".footerBox").css("z-index","1");
- $("#menu").css("z-index","1");
- $("#hiddenBox").show(showOverlay());
- swiper();
- setTimeout(function () {
- myScroll.refresh();
- }, 100);
- });
- $(".chooseDweb,.checkBox").on("tap",function (e) {
- e.stopPropagation();
- if ($(this).find("input[type='checkbox']").is(":checked")) {
- $(this).find("input[type='checkbox']").removeAttr("checked");
- } else {
- $(this).find("input[type='checkbox']").prop("checked", true);
- }
- });
- $("#overlay").click(function(){
- $(".ar_header").animate({"z-index":"9"},200);
- $("nav").animate({"z-index":"9"},200);
- $(".dangan_iscroll").animate({"z-index":"9"},200);
- $(".footerBox").animate({"z-index":"9"},200);
- $("#menu").animate({"z-index":"9"},200);
- $("#hiddenBox").hide(hideOverlay());
- });
-
- //touchmove的阻止浏览器或者屏幕滚动默认事件
- document.addEventListener("touchmove", function (e) {
- e.preventDefault();
- }, false);
- /* 内容切换*/
- $('footer div').click(function(){
- $(this).addClass("active").siblings().removeClass();//removeClass就是删除当前其他类;只有当前对象有addClass("active");siblings()意思就是当前对象的同级元素,removeClass就是删除;
- $(".container > section").hide().eq($('footer div').index(this)).show();
- var type = $(this).data("for");
- if (type == "gz") {
- haifmp.loadMobilePage("haifm", "hpSjlrDaIndex.htm?mcid=" + $("#mcid").val());
- }
- if (type == "mz") {
- haifmp.loadMobilePage("haifm", "hpSjlrMzDaIndex.htm?mcid=" + $("#mcid").val());
- }
- });
-
- /* 列表切换*/
- $(".hiddenBoxTop div").click(function(){
- $(this).addClass("active").siblings().removeClass();
- $(".option").hide().eq($('.hiddenBoxTop div').index(this)).show();
- setTimeout(function () {
- myScroll.refresh();
- }, 100);
- });
-
- /* 单选和多选 复选框事件*/
- $(".submit").bind("click", function () {
- var result1 = new Array();
- var resultId1 = new Array();
- var result2 = new Array();
- var resultId2 = new Array();
-
- resultId1.push(",");
- resultId2.push(",");
- $("[name = chkItem]:checkbox").each(function () {
- if ($(this).is(":checked")) {
- result1.push($(this).parent().next().text());
- resultId1.push($(this).attr("id"));
- }
- });
- $("[name = chkmsg]:checkbox").each(function () {
- if ($(this).is(":checked")) {
- result2.push($(this).parent().next().text());
- resultId2.push($(this).attr("id"));
- }
- });
- $("nav .zhushe").show();
- $(this).parent().hide(hideOverlay());
- var rows = $(".rowll");
- if (resultId1.length > 0 || resultId2.length > 0 ) {
- rows.addClass("hidden");
- rows.find(".btn-group").addClass("dropup");
- for (var i = 0; i < rows.length; i++) {
- for (var j = 0; j < resultId1.length; j++) {
- if (rows.eq(i).data("sl") == resultId1[j]) {
- rows.eq(i).removeClass("hidden");
- }
- }
- for (var j = 0; j < resultId2.length; j++) {
- if (rows.eq(i).data("dqzt") == resultId2[j]) {
- if (resultId1.length <= 0) {
- rows.eq(i).removeClass("hidden");
- }
- }
- }
- }
- } else {
- rows.removeClass("hidden");
- }
- $(".ar_header").animate({"z-index":"1"},200);
- $("nav").animate({"z-index":"1"},200);
- $(".dangan_iscroll").animate({"z-index":"1"},200);
- $(".footerBox").animate({"z-index":"1"},200);
-
- var dqzt = "0";
- var sl = "0";
- if (result1.length > 0) {
- sl = "1";
- }
- if(result2.length > 0) {
- dqzt = "1";
- }
-
- haifmp.loadMobilePage("haifm", "hpSjlrMzDaIndex.htm?mcid=" + $("#mcid").val() + "&dqzt=" + dqzt + "&dqztArray="+resultId2 + "&sl=" + sl + "&slArray=" + resultId1);
- });
-
- /* 全选复选框事件*/
- $("#btnCheckAllLanShe").bind("click", function () {
- var isChecked = $(this).prop("checked");
- $("input[name='chkItem']").prop("checked", isChecked);
- });
-
- $("#btnCheckAllStaus").bind("click", function () {
- var isChecked = $(this).prop("checked");
- $("input[name='chkmsg']").prop("checked", isChecked);
- });
-
- $("#dweb").bind("blur", function() {
- haifmp.loadMobilePage("haifm", "hpSjlrMzDaIndex.htm?mcid=" + $("#mcid").val() + "&cxeph=" + $("#dweb").val());
- });
-
- $("#dweb").bind("focus", function() {
- $("#ct").val("mzsearch");
- });
-
- $("#dweb").bind("change", function() {
- if ($("#dweb").val() == "") {
- $("#ct").val("mzwd");
- }
- });
- var dweb = $("#dweb").val();
- if (dweb != "") {
- $("#ct").val("mzsearch");
- }
-
- $(".rowll > .dropdownBtn").on("tap", function() {
- var id = $(this).data("for");
- if (id != "") {
- haifmp.loadMobilePage("haifm", "hpSjlrMzxx.htm?mcid=" + $("#mcid").val() + "&id=" + id + "&ztsl=" + $("#ztsl").val());
- }
- });
- //模糊查询键盘enter键事件
- $("input[type='search']").on('keypress',function(e) {
- var keycode = e.keyCode;
- if(keycode=='13') {
- e.preventDefault();
- //请求搜索接口
- haifmp.loadMobilePage("haifm", "hpSjlrMzDaIndex.htm?mcid=" + $("#mcid").val() + "&cxeph=" + $("#dweb").val());
- }
- });
- });
- /* 选项卡*/
- function swiper(){
- new Swiper('.swiper-container',{
- pagination : '.swiper-pagination',
- prevButton:'.swiper-button-prev',
- nextButton:'.swiper-button-next',
- direction : 'horizontal',
- paginationClickable:true,
- touchMoveStopPropagation : false,
- followFinger: false,
- paginationClickable: true,
- touchAngle : 60,//允许触发拖动的角度值(60)
- speed:300,
- touchMoveStopPropagation : false,
- //ajax动态循环生成当到第二页的时候始终滑动不起来的方法
- //分页器消失解决方法
- observer:true,//修改swiper自己或子元素时,自动初始化swiper
- observeParents:true,//修改swiper的父元素时,自动初始化swiper
- onSlideChangeEnd: function(swiper){
- swiper.update(); //swiper滑动的时候滑动到第3屏就滑动不了的解决办法
- }
- });
- }
- /* 显示遮罩层 */
- function showOverlay(){
- $("#overlay").height(pageHeight());
- $("#overlay").width(pageWidth());
- // fadeTo第一个参数为速度,第二个为透明度
- // 多重方式控制透明度,保证兼容性,但也带来修改麻烦的问题
- $("#overlay").fadeTo(200, 0.5);
- };
- /* 隐藏覆盖层 */
- function hideOverlay(){
- $("#overlay").fadeOut(200);
- };
- /* 当前页面高度 */
- function pageHeight(){
- return document.body.scrollHeight;
- };
- /* 当前页面宽度 */
- function pageWidth(){
- return document.body.scrollWidth;
- };
- /**
- * 返回
- */
- function backUrl() {
- haifm.loadMobilePage("haifm", "haifmvMain.htm?uuid=" + $("#uuid").val() + "&mcid=" + $("#mcid").val() + "&qyid=" + $("#qyid").val() +"&toList=2");
- $("footer.row").css("display","block");
- }
- /**
- * 新增母猪档案
- */
- function addMzda() {
- haifmp.loadMobilePage("haifm", "hpSjlrMzdaAdd.htm?mcid=" + $("#mcid").val());
- }
|