2013-06-12 36 views
0

調整問題,請通過下面的圖片
https://dl.dropboxusercontent.com/u/36614618/Doubts/onlineChatImg.jpg
在上面的圖片「圖片01」,你可以在HTML文件的右側找到onlineChat股利。當我將鼠標懸停在在線聊天室上時,我們可以找到搜索輸入,並在線聊天的底部隱藏在線聊天按鈕'|>'。請通過上面的圖片'圖片02'。現在當我點擊隱藏按鈕'|>'時,onlinechat div正在隱藏'圖片03'。 onlinechat div一旦隱藏,就會顯示另一個圖標,再次顯示onlinechat'| <'。直到現在它的工作正常。
但問題是,當我調整窗口大小時,Onlinechat Div會自動顯示。我在尋找的是當窗口調整大小,如果onlinechat隱藏,那麼它應該被隱藏(不應該顯示)。
以上概念像Facebook在線聊天的有些相同
窗口使用jQuery

$('#onlineFriendsSearchShow').hide();// Default Search input is hide. 

$('#OnlineChathideShowIcon').on('click',function(){ //When clicked on '|>' button, onlineChat div hide and left part div gets width of 100%. 
    $('#rapMusicSocialNetworkRightPart').hide();//onlineChat div getting hide. 
    $('#rapMusicSocialNetworkLeftPartWrapper').css('width','100%'); //Left part gets width of 100%. 
    $('#onlineFriendsSearchShow').show();//show button '|<' gets displayed. 
}); 

$('#onlineFriendsSearchShow').bind('click',function(){ //When clicked on '|<' show button. (to get right onlineChat div back). 
    $(this).hide();//'|<' button hide. 
    $('#onlineFriendsSearch').show();//search input show. 
    $('#rapMusicSocialNetworkRightPart').show();//onlineChat div show. 

    var widthRap = $(window).width()-201;//created variable having mainWindow width - onlineChat Div width. 
    $('#rapMusicSocialNetworkLeftPartWrapper').css('width',widthRap);//variable value assigning to left part, so left and right divs get's adjusted within document. 
}); 

回答

0

你需要做一些刷新:

$(window).resize(function() { 
    var widthRap = $(window).width()-201;//created variable having mainWindow width - onlineChat Div width. 
    $('#rapMusicSocialNetworkLeftPartWrapper').css('width',widthRap);//variable value assigning to left part, so left and right divs get's adjusted within document. 
});