javascript - jQuery converted codes wont work -
Hello there I am trying to convert java code to jquery for better performance.
Here are my JS code I:
(function () {var body_container = document.body, content = document.querySelector ( '.Content- wrap "), open_menu = document.getElementById ( 'open button'), close_menu = document.getElementById ( 'close-button'), checkifOpen = false; function init () {initialize_process ();} function initialize_process () {open_menu.addEventListener ( 'click "ToggleMenu); if (close_menu) {close_menu. addEventListener (toggleMenu 'click'); if the goal is not ITA menu element or close a .. content.addEventListener ( 'click'} // menu elements of his descendants Are, function (EV) {var target = EV .target, if target (checkifOpen & amp; P == open_menu!) {ToggleMenu ();}});} Now here's my change jQuery version of JavaScript:
(function () {var body_container = $ ( 'body'), content = $ ( '.content-wrap'), open_menu = $ ( '.open-button'), close_menu = $ ( '.close-button'), Chekf Open = false; function init () {initialize_process (); } Function initialize_process () {open_menu.bind ('click', toggle menu); If (close_menu) {close_menu.bind ('click', toggle menu); If the goal is not ITA menu element or one of its descendants .. content.bind ('click') menu element close //, function (EV) {var target = ev.target, if (checkifOpen & amp; Goal! == Open_Menu) {toggleMenu ();}}); } This code will not work for any reason. Just wondering where I went wrong. Especially in that part where I work with Adenant Lisener Javascript.
Any help would be appreciated.
The original code you are not using right selectors is:
document.getElementById ('Open Button') Which ID is an element ID ID with "open-button" in the new code: Open_menu = $ ('.open-button')
Which one element (or set of elements) recognizes class < To use / code> "Open-Button" ID , you must have # : open_menu = $ ('# open-button ') Must be used having further problems Mr. Chance, but expected to be launched by this problem will not work
Comments
Post a Comment