$.showMsg = function(){
alert('hello,welcome to study jquery plugin dev');
}
// $.showMsg();
$.showName = function(){
console.log( 'ghostwu' );
}
$.showName();
$.fn.showValue = function(){
return $(this).val();
}
$(function(){
$("input").click(function(){
// alert($(this).showMsg());
alert($(this).showMsg());
});
});
<input type="button" value="点我">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://cdn.bootcss.com/jquery/1.12.0/jquery.js"></script>
<style>
#tab {
width:400px;
height:30px;
}
#tab li, #tab ul {
list-style-type:none;
}
#tab ul {
width:400px;
height: 30px;
border-bottom:1px solid #ccc;
line-height: 30px;
}
#tab ul li {
float:left;
margin-left: 20px;
padding:0px 10px;
}
#tab ul li.active {
background: yellow;
}
#tab ul li a {
text-decoration: none;
color:#666;
}
#tab div {
width:400px;
height:350px;
background-color:#ccc;
}
.clearfix:after{
content: '';
display: block;
clear: both;
height: 0;
visibility: hidden;
}
</style>
<script src="tab2.js"></script>
<script>
$(function(){
$("#tab").tabs( { evType : 'mouseover' } );
});
</script>
</head>
<body>
<div id="tab">
<ul class="clearfix">
<li><a href="#tab1">选项1</a></li>
<li><a href="#tab2">选项2</a></li>
<li><a href="#tab3">选项3</a></li>
</ul>
<div id="tab1">作者:ghostwu(1)
<div>博客: http://www.cnblogs.com/ghostwu/</div>
</div>
<div id="tab2">作者:ghostwu(2)
<div>博客: http://www.cnblogs.com/ghostwu/</div>
</div>
<div id="tab3">作者:ghostwu(3)
<div>博客: http://www.cnblogs.com/ghostwu/</div>
</div>
</div>
</body>
</html>
;(function ($) {
$.fn.tabs = function (opt) {
var def = { evType: "click" }; //定义了一个默认配置
var opts = $.extend({}, def, opt);
var obj = $(this);
$("ul li:first", obj).addClass("active");
obj.children("div").hide();
obj.children("div").eq(0).show();
$("ul li", obj).bind(opts.evType, function () {
$(this).attr("class", "active").siblings("li").attr("class","");
var id = $(this).find("a").attr("href").substring(1);
obj.children("div").hide();
$("#" + id, obj).show();
});
};
})(jQuery);
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有