javascript - jquery .unbind and .bind not working -
I need to bind and close based on the click of a button. What happens first here:
& lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ('.xxMenu & gt; li'). Bind ('mouseover', OpenSub menu); [... etc] & lt; / script & gt;
This functions some drop-down menu functions. In the next script, if I put one of the following, then works fine to split the above and thus disables the menu When a search button is clicked:
<(> .xxMenu> li '); unbind ();This is the way I'm notified, Do not work to open it Unbind ('mouseover', openSubMenu);
Now, after that in the script,
If I do not bring any of the following back, then it splits again, that is, for the first time (when someone clicks the button to cancel the search). This is the complete script in this case:
& lt; script type = "text / javascript" & gt; $ (document) .ready (function () {$ (close .img '). Bind (' click ' Close the shortbar); Close the functionSearch () {$ ('form.xxx'). CSS ('visibility', 'hidden'); $ ('Close search & gt; img'). CSS ('visibility', 'hidden'); $ ('Search_icon & gt; img'). CSS ('visibility', 'visible'); / * People who are not working * / $ ('.xxMenu & gt; li'). Bind (); / * Or * / $ ('.xxMenu & gt; Li'). Bind ('mouseover'); / * Or * / $ ('.xxMenu & gt; Li'). Bind ('Mouseover', OpenSub menu); }; }); & Lt; / Script & gt;
I am thinking that syntax or logic is wrong, but it is unable to understand.
Update: The whole thing on request is sorry, I thought I was saving just by posting important parts all the time. New enough on this
& lt ;! - Active drop down menu - & gt; & Lt; Script type = "text / javascript" & gt; $ ('.xxMenu & gt; li'). On ('mouseout', closeSubMenu) ('Mouseover', OpenSubMenu); $ (Document). Function OpenSubMenu () {$ (this) .Find ('UL'). CSS ('Visibility', 'View');}; Close the function submenu () {$ (this) .fund ('ul'). CSS ('visibility', 'hidden');};}); & Lt; / Script & gt; & Lt ;! - Open search field - & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ('search_icon & gt; img'). ('Click', showSearch); function showSearch () {$ ('. Search macro. Search-macro-query input CSS ('width', '533 px'); $ ('form.aoi'). Css ('visibility', 'visible'); $ ('form.aui'). Css ('z-index', ' 15 '); $ (' close search 'img'). CSS ('visibility', 'visible'); $ ('search-macro-button'). CSS ('visibility', 'hidden'); $ ('. SearchIcon> img'). Close the CSS ('visibility', 'hidden'); / * drop-down menu * / $ ('.xxMenu & gt; li') ('mouseover'). ;};}); & Lt; / script & gt; ; & Lt;! - Close the search field when clicking the X button - & gt; & lt; script type = "text / javascript" & gt; $ (document). $ ('Form.aui'). $ (' $ ('. Close search' img '). CSS (' visibility ',' hidden '); $ (' search_icon & gt; img '). CSS ( 'Visibility', 'Visible'); / * Enable the drop-down menu if the search has been canceled * / $ ('.xxMenu & gt; li'). ('Mouseover', openSubMenu); };}); & Lt; / Script & gt; & Lt ;! - Any search input typed in the field - & gt; Show live search button & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ('form.aui'). On ('keypress', changeImgs); function changeImgs () {$ (close.Search & gt; img '). CSS (' visibility ',' Hidden '); $ (' .aui-button '). CSS ({' z-index ':' 12 ',' visibility ':' visible ',' position ':' relative ',' left ': '292px', 'Border': '0 pixels',' border-radius': '0 pixels',' background ':' url (http://ops.confluence.uat.apg.services.gs.com:18090 $ ('Input.text'). $ ('{Input' Range ':' 0 px '}); / * gray confluence search submit button * / $ ('. Search (> '>'> ''> '' '>' ''
Comments were answered from the comments:
"Out of the ready handler area Announce the task right now "
Putting it in just one answer, if it is useful for other people, a basic question that I know, but still
Comments
Post a Comment