2014-02-18 59 views
-3

我想使用HTML按钮淡出(点击它后),并有一个表使用jQuery出现...这不是很好。这是我的HTML,CSS和Js。在jQuery中寻找帮助(按钮)

<br> 
     <button id="boutton" ; 
      <p id="boutton"> Meteo du Jour! </p> 
     </button> 
     <table id="tableau"> 
      <tr> 
       <td> 
        <table> 
         <thead> 
          <tr> 

我的CSS

#boutton { 
    color: blue; 
    height: 30px; 
    width: 150px; 
    background-color: #8b8b8b; 
    text-align:center; 
    margin:auto; 
    border: 5px #2d2d2d solid; 
    border-radius: 10px; 
} 

#tableau { 
    border: 8px solid #2d2d2d; 
    width: 50%; 
    height: 25%; 
    border-radius: 20px; 
    visibility: hidden; 
} 

table { 
    border: 8px solid blue; 
    width: 50%; 
    height: 25%; 
    border-spacing: 25px; 
    background: #8b8b8b; 
    border-radius: 20px; 
    visibility: hidden; 
} 

,这是我的jQuery

$("#boutton").click(function(){ 
$("#tableau").css({"visibility":"visible"}); 
$("table").css({"visibility":"visible"}); 
$("#boutton").fadeOut(slow, linear); 
+2

你愿意把所有的代码在的jsfiddle? – steinmas

+0

是的,请将您的代码降低到绝对最小值。没有像背景颜色,边界半径等等的噪音。 – lex82

+0

您的HTML代码的第二行有错误。 – Brian

回答

1

这里是一个的jsfiddle你

jsFiddle

有你jQue一些错误ry(缺少括号,括号)所以我修复了这些并删除了一些我发现多余的东西

$("#boutton").click(function() { 
$("#tableau").css({"visibility":"visible"}); 
$("#boutton").fadeOut("slow"); 
}); 

祝你好运!

0

添加到乔希的解决方案,你可以使用jQuery切换隐藏/显示表。

jQuery documentation

JQUERY

$("#boutton").click(function() { 
    $("#tableau").toggle(); 
    $("#boutton").fadeOut("slow"); 
}); 

CSS

#tableau { 
    display: none; 
} 

jsFiddle