2012-10-11 71 views
0

我一直在jQuery的滑塊,滑出一旦記錄被點擊,然後當你點擊關閉它幻燈片退出屏幕..我原本的問題是,如果我點擊記錄兩次,它會嘗試加載它上面的相同信息自我,並創建堆錯誤..所以我發現了一些代碼,我可以使用deelte所有的數據,然後移動滑塊面板回屏幕問題我有它抹所有的細節,我不會移動,但我只有把JavaScript代碼放在這裏,看看是否有人可以告訴我什麼即時通訊代碼做錯了,如果可能的話如何解決它...擦div數據和隱藏滑塊

function deleteParentElement(){ 
     $(this).parent().animate({right:-1000}); // on its own as an onlcick event 
attached to the button it works on its own the pane its moving class is called "details" 
     $('.student').remove() //the class defined in here is only the div containing the data 
     e.stopPropagation() 
    } 

這是用於tr的按鈕igger功能

<button style="position: absolute; top:40px; right:25px;" href="#" id="bt-close" class="<? echo $Stu_id;?>" onClick="deleteParentElement()">Close</button> 

回答

0

你錯過了兩個分號和

$(document).ready(function(){ 
//the rest of the code 
}); 

...這可能是你的問題

+0

我在哪裏neeed把2半個coloumns感謝? $('。student')。remove();後面的 – Matthew

+0

和e.stopPropagation(); ...每次在jquery中你都有一個類似remove()的命令,你需要一個分號(除非它不是命令的結尾,比如parent()。hide();)。 ..這也適用於$(document).ready(function(){ //代碼 }的其餘部分)等事件。 – NinJoel