var app = { config: config || {}, // 简单的点击实现元素展开和收缩的功能 clickToggle: function(elea,eleb){ $(elea).click(function(){ if(!$(eleb).is(':visible')){ $(this).addClass('clicked'); $(eleb).slideDown(); }else{ $(this).removeClass('clicked'); $(eleb).slideUp(); } }) }, //返回顶部 backTop: function(ele,time){ $(ele).click(function () { $('html, body').animate({ scrollTop:'0' },time); }) }, // 随机数字 RndNum: function(n){ var rand=""; for(var i=0;i'); var left = _this.css("padding-left"); _this.parent().append('' + _this.attr("placeholder") + ''); if(_this.val() != ""){ _this.parent().find("span.placeholder").hide(); } else{ _this.parent().find("span.placeholder").show(); } }).on("focus", function(){ $(this).parent().find("span.placeholder").hide(); }).on("blur", function(){ var _this = $(this); if(_this.val() != ""){ _this.parent().find("span.placeholder").hide(); } else{ _this.parent().find("span.placeholder").show(); } }); // 点击表示placeholder的标签相当于触发input $("span.placeholder").on("click", function(){ $(this).hide(); $(this).siblings("[placeholder]").trigger("click"); $(this).siblings("[placeholder]").trigger("focus"); }); $("input[name='checkcode']").css('width', '100%').parents('.input-box').css('display','inline-block'); }, // 防复制代码 antiClone: function () { // 防止ctrl+C document.onkeydown = function (e) { var e = e || event; if (e.ctrlKey == 1 && e.keyCode == 67) { return false; } }; // 阻止复制 document.body.oncopy = function (){ return false; }; //禁止选取 document.body.onselectstart=document.body.oncontextmenu=function(){return false;}; }, }; //当配置为普通站的时候,手机站跳转 if(app.config.hasOwnProperty('mUrl') && app.config.murl !== 'm') { app.mobile(); }