user3504751 user3504751 - 28 days ago 9
Javascript Question

calling external js file function in javascript/jquery of html page

I have a html page with a bit of javascript that applies to a button......

$('.iconM-testimonials').on('click', function () {
$("#colorscreen").remove()
$("body").append('<div id="colorscreen" class="animated"></div>')
$("#colorscreen").addClass("fadeInUpBig");
$('.fadeInUpBig').css('background-color', 'rgba(164, 196, 0, 0.3)');
$(".tile-group.main").css({ width: "720px"}).load("musability-musictherapy-company-overview.html");
});


It is attached to a button that is within a menu that pops out and has its own js file to make sure this happens... here is an extract of the open/close function within the external js file....

// open (or close) the menu
this.trigger.addEventListener( this.eventtype, function( ev ) {
ev.stopPropagation();
ev.preventDefault();
if( self.open ) {
self._resetMenu();
} else {
self._openMenu();
// the menu should close if clicking somewhere on the body (excluding clicks on the menu)
document.addEventListener( self.eventtype, function( ev ) {
if( self.open && !hasParent( ev.target, self.el.id ) ) {
bodyClickFn( this );
}
});
}
});


Basically I want to ammend the first javascript function to include a "close the menu" bit when it has executed the functions like colorscreeen.remove etc.... any help on this would be great as I don't even know if i can do this.

the html has a button currently that opens and closes the menu here is that html....

<div class="navbtn">
<a href="#" id="trigger" class="menu-trigger">Menu</a>
</div>

Answer

question has become dated and not answered .

Comments