user3504751 user3504751 - 1 year ago 64
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 () {
$("body").append('<div id="colorscreen" class="animated"></div>')
$('.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 ) {
if( ) {
} else {
// the menu should close if clicking somewhere on the body (excluding clicks on the menu)
document.addEventListener( self.eventtype, function( ev ) {
if( && !hasParent(, ) ) {
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>

Answer Source

question has become dated and not answered .

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download