-2

excuse me, can somebody help me translate this code to normal JS(if it is possible)??

$(function() {
    $('#nav-accordion').dcAccordion({
        eventType: 'click',
        autoClose: true,
        saveState: true,
        disableLink: true,
        speed: 'slow',
        showCount: false,
        autoExpand: true,
//        cookie: 'dcjq-accordion-1',
        classExpand: 'dcjq-current-parent'
    });
});
Ryan Arief
  • 983
  • 2
  • 16
  • 36

1 Answers1

2

You need to translate all the code inside the dcAccordion plugin to native JavaScript. Not an easy tasks. For the $(function () {}), you can do the following:

window.ondomready = function () {

};

And the ondomready concept is too huge, for a trailer, please look at this answer: pure JavaScript equivalent to jQuery's $.ready() how to call a function when the page/dom is ready for it.

In a nutshell, it says:

document.addEventListener('DOMContentLoaded', fn, false);
window.addEventListener('load', fn, false );
document.attachEvent("onreadystatechange", fn);
window.attachEvent("onload", fn);
Community
  • 1
  • 1
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252