最后
你要问前端开发难不难,我就得说计算机领域里常说的一句话,这句话就是『难的不会,会的不难』,对于不熟悉某领域技术的人来说,因为不了解所以产生神秘感,神秘感就会让人感觉很难,也就是『难的不会』;当学会这项技术之后,知道什么什么技术能做到什么做不到,只是做起来花多少时间的问题而已,没啥难的,所以就是『会的不难』。
开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】
我特地针对初学者整理一套前端学习资料
$(“#mb_btn_ok”).focus().keypress( function(e) {
if( e.keyCode == 13 || e.keyCode == 27 ) $(“#mb_btn_ok”).trigger(‘click’);
});
break;
case ‘confirm’:
$(“#mb_btn_ok”).click( function() {
$.alerts._hide();
if( callback ) callback(true);
});
$(“#mb_btn_no”).click( function() {
$.alerts._hide();
if( callback ) callback(false);
});
$(“#mb_btn_no”).focus();
$(“#mb_btn_ok, #mb_btn_no”).keypress( function(e) {
if( e.keyCode == 13 ) $(“#mb_btn_ok”).trigger(‘click’);
if( e.keyCode == 27 ) $(“#mb_btn_no”).trigger(‘click’);
});
break;
}
},
_hide: function() {
$(“#mb_box,#mb_con”).remove();
}
}
// Shortuct functions
myAlert = function(title, message, callback) {
$.alerts.alert(title, message, callback);
}
myConfirm = function(title, message, callback) {
$.alerts.confirm(title, message, callback);
};
//生成Css
var GenerateCss = function () {
$(“#mb_box”).css({ width: ‘100%’, height: ‘100%’, zIndex: ‘99999’, position: ‘fixed’,
filter: ‘Alpha(opacity=60)’, backgroundColor: ‘black’, top: ‘0’, left: ‘0’, opacity: ‘0.6’
});
$(“#mb_con”).css({ zIndex: ‘999999’, width: ‘350px’,height:‘200px’, position: ‘fixed’,
backgroundColor: ‘White’,
});
$(“#mb_tit”).css({ display: ‘block’, fontSize: ‘14px’, color: ‘#444’, padding: ‘10px 15px’,
backgroundColor: ‘#fff’, borderRadius: ‘15px 15px 0 0’,
fontWeight: ‘bold’
});
$(“#mb_msg”).css({ padding: ‘20px’, lineHeight: ‘40px’, textAlign:‘center’,
fontSize: ‘18px’ ,color:‘#4c4c4c’
});
$(“#mb_ico”).css({ display: ‘block’, position: ‘absolute’, right: ‘10px’, top: ‘9px’,
border: ‘1px solid Gray’, width: ‘18px’, height: ‘18px’, textAlign: ‘center’,
lineHeight: ‘16px’, cursor: ‘pointer’, borderRadius: ‘12px’, fontFamily: ‘微软雅黑’
});
$(“#mb_btnbox”).css({ margin: ‘15px 0px 10px 0’, textAlign: ‘center’ });
$(“#mb_btn_ok,#mb_btn_no”).css({ width: ‘80px’, height: ‘30px’, color: ‘white’, border: ‘none’, borderRadius:‘4px’});
$(“#mb_btn_ok”).css({ backgroundColor: ‘#41a259’ });
$(“#mb_btn_no”).css({ backgroundColor: ‘gray’, marginRight: ‘40px’ });
//右上角关闭按钮hover样式
$(“#mb_ico”).hover(function () {
$(this).css({ backgroundColor: ‘Red’, color: ‘White’ });
}, function () {
$(this).css({ backgroundColor: ‘#DDD’, color: ‘black’ });
});
var _widht = document.documentElement.clientWidth; //屏幕宽
var _height = document.documentElement.clientHeight; //屏幕高
var boxWidth = $(“#mb_con”).width();
var boxHeight = $(“#mb_con”).height();
//让提示框居中
$(“#mb_con”).css({ top: (_height - boxHeight) / 2 + “px”, left: (_widht - boxWidth) / 2 + “px” });
}
})(jQuery);
=========================================================================
项目需要引入jQuery
=========================================================================
myAlert(“title”,“message”,function(){
/点击确定执行的代码/
})
例如:
myConfirm(“title”,“message”,function () {
/点击确定执行的代码/
})
例如:
到此,新样式的alert()和confirm()就能正常使用了~
打开全栈工匠技能包-1小时轻松掌握SSR
两小时精通jq+bs插件开发
生产环境下如歌部署Node.js
开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】
网易内部VUE自定义插件库NPM集成
谁说前端不用懂安全,XSS跨站脚本的危害
webpack的loader到底是什么样的?两小时带你写一个自己loader
MWI4NjM0NTk3ZTFjOWQwN19oZC5qcGc?x-oss-process=image/format,png)
webpack的loader到底是什么样的?两小时带你写一个自己loader