Mega menu width & Scripts.js

Hello.
I wanted to change the width of mega menu. I found this code in scripts.js:

/* ---------------------------------------------------------------------------
* Header width
* --------------------------------------------------------------------------- */
function mfn_header(){
var rightW = $('.top_bar_right').innerWidth();
var parentW = $('#Top_bar .one').innerWidth() - 10;
var leftW = parentW - rightW;
$('.top_bar_left, .menu > li > ul.mfn-megamenu').width( leftW );
$('.top_bar_left').removeClass( 'loading' );
}

and changed it to:

function mfn_header() {
var rightW = $('.top_bar_right').innerWidth();
var parentW = $('#Top_bar .one').innerWidth() - 10;
var leftW = parentW - rightW - 200;
$('.top_bar_left, .menu > li > ul.mfn-megamenu').width(leftW);
$('.menu > li > ul.mfn-megamenu ').css('left', 100);
$('.top_bar_left').removeClass('loading');
}

It does what I need but in this way I have to change that file whenever you update BeTheme. So avoid to editing files everytime I've tryed to add this code to "Custom Js" section in theme options:

jQuery(function ($) {
function mfn_header() {
var rightW = $('.top_bar_right').innerWidth();
var parentW = $('#Top_bar .one').innerWidth() - 10;
var leftW = parentW - rightW - 200;
$('.top_bar_left, .menu > li > ul.mfn-megamenu').width(leftW);
$('.menu > li > ul.mfn-megamenu ').css('left', 100);
$('.top_bar_left').removeClass('loading');
}
});

But it doesn't work. Any idea why? Or how I can apply this changes without editing theme files?

Comments

Sign In or Register to comment.