示例代码有错误,少了一行,应该在:
var $div2 = $("#divtest2");
这行下方加入一行:
$div2.hide(); //隐藏div2
这样才能看到效果
var $div2 = $("#divtest2");
这行下方加入一行:
$div2.hide(); //隐藏div2
这样才能看到效果
2015-08-21
$(".content a").jqzoom(
{ //绑定图片放大插件jqzoom
zoomWidth: 200, //小图片所选区域的宽
zoomHeight: 200, //小图片所选区域的高
zoomType: 'reverse' //设置放大镜的类型
});
{ //绑定图片放大插件jqzoom
zoomWidth: 200, //小图片所选区域的宽
zoomHeight: 200, //小图片所选区域的高
zoomType: 'reverse' //设置放大镜的类型
});
2015-08-21
// 从上往下看。
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>挑战题</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
</head>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>挑战题</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li>1 </li>
<li>2 </li>
<li>3 </li>
<li>4 </li>
<li>5 </li>
<li>6 </li>
<li>7 </li>
<li>8 </li>
</ul>
<a id="show" >更多</a>
</body>
<ul>
<li>1 </li>
<li>2 </li>
<li>3 </li>
<li>4 </li>
<li>5 </li>
<li>6 </li>
<li>7 </li>
<li>8 </li>
</ul>
<a id="show" >更多</a>
</body>
<script>
$(document).ready(function(){
$("li:gt(3)").hide();
$("li:last").show();
$("#show").click(function(){
if ($("#show").text()=="更多"){
$("li").show();
$("#show").html('简化');
}
else{
$("li:gt(3)").hide();
$("li:last").show();
$("#show").html('更多');
}
});
});
</script>
$(document).ready(function(){
$("li:gt(3)").hide();
$("li:last").show();
$("#show").click(function(){
if ($("#show").text()=="更多"){
$("li").show();
$("#show").html('简化');
}
else{
$("li:gt(3)").hide();
$("li:last").show();
$("#show").html('更多');
}
});
});
</script>
通过使用$("li:has('p')")选择器代码,获取了包含<p>元素的全部<li>元素,并通过css方法改变了这些元素在页面中显示的文字样式。
2015-08-20
$("#frmTest :input").addClass("bg_blue"); 中间有个空格不能忘
2015-08-20