我希望在单击按钮时从浏览器的左边缘滑动面板,并在单击相同的按钮(切换)时隐藏面板.
HTML
<div class="panel">
</div>
<a href="javascript:void(0);" class="slider-arrow show">»</a>
Run Code Online (Sandbox Code Playgroud)
CSS
.panel {
width:300px;
float:left;
height:550px;
background:#d9dada;
position:relative;
left:-300px;
}
.slider-arrow {
padding:5px;
width:10px;
float:left;
background:#d9dada;
font:400 12px Arial, Helvetica, sans-serif;
color:#000;
text-decoration:none;
position:relative;
left:-300px;
}
Run Code Online (Sandbox Code Playgroud)
jQuery的
$(function(){
$('.slider-arrow.show').click(function(){
$( ".slider-arrow, .panel" ).animate({
left: "+=300"
}, 700, function() {
// Animation complete.
});
$(this).html('«').removeClass('show').addClass('hide');
});
$('.slider-arrow.hide').click(function(){
$( ".slider-arrow, .panel" ).animate({
left: "-=300"
}, 700, function() {
// Animation complete.
});
$(this).html('»').removeClass('hide').addClass('show');
});
});
Run Code Online (Sandbox Code Playgroud)
它显示面板但不隐藏面板.使用选择器有任何问题吗?
我在表中有5列.第1列有一个名为name ="strurl1"的复选框,name ="strurl2",name ="strurl3"等.如果选中,表行背景颜色将从#f1f1f1更改为#e5e5e5.
我试过但代码不能正常工作.
主要的CSS是
.overviewtable tbody tr td {
line-height:normal;
border-top:1px solid #FFF;
border-bottom:1px solid #c4c4c4;
height:35px;
padding-top:10px;
padding-bottom:5px;
background-color:#f1f1f1;
}
.overviewtable tbody tr td.col1 {
width:316px;
padding-left:15px;
border-left:4px solid #FFF;
font-size:12px;
color:#999999;
}
Run Code Online (Sandbox Code Playgroud)
表列名为col1,col2,col3,col4和col5.
有帮助吗?提前致谢.
我想在单击以显示文本区域时将链接"添加其他注释",并将文本切换为"删除注释".单击"删除注释"时,它应隐藏文本区域,文本需要更改为"添加其他注释".
我用的代码是
<script type="text/javascript">
$(document).ready(function( ){
$("#addcmt").click(function( )
{
$(".commentarea").toggle( );
if ($("#addcmt").text = "Add additional comment") {
$("#addcmt").text("Remove comment");
}
else {
$("#addcmt").text("Add additional comment");
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
html是
<div class="addlcomment">
<a id="addcmt">Add additional comment</a>
</div>
<div class="commentarea" style="display:none;">
<textarea name="strcomments1" tabindex="2"></textarea>
</div>
Run Code Online (Sandbox Code Playgroud)
文本切换不起作用.
任何帮助表示赞赏.
该脚本在此处用于突出显示带有jquery的表行和列。 在这里演示
它突出显示悬停时的整个行和整个列。我只想将鼠标悬停在当前单元格上,而不要超出当前单元格的行和列位置。
脚本
$("table").delegate('td','mouseover mouseleave', function(e) {
if (e.type == 'mouseover') {
$(this).parent().addClass("hover");
$("colgroup").eq($(this).index()).addClass("hover");
}
else {
$(this).parent().removeClass("hover");
$("colgroup").eq($(this).index()).removeClass("hover");
}
});
Run Code Online (Sandbox Code Playgroud)
有什么帮助吗?