Hi,
I got Smartmenus 0.0.1-beta working in Flare but really wanted the ‘link’ collapsible behaviour that comes with 1.1.0 (where a parent topic name acts only as a link to the page and the +/- button opens and closes the sub menu.
It was tricker to get 1.1.0 working as I got a a requirejs ‘Mismatched anonymous define() modules’ error, when I switched. So instead of importing the scripts in the html, I used the requirejs loader instead. By preventing it loading jquery twice (Flare already provides jquery), I’ve got it working to a point.
Unfortunately, three things are going wrong:
– the ‘link’ behaviour isn’t working, the parent topic expands the sub menu
– the + button doesn’t work – the submenu flashes open then immediately closes on mouseup
– the second level submenu appears to the right of the submenu instead of underneath
In the pages I’m loading my main.js initialisation code…
<script src="../smartmenus-1.1.0/main.js" type="text/javascript"></script>
And main.js….
require.config({
paths: {
"jquery": "jquery.min.js"
}
});
if (typeof jQuery === 'function') {
//jQuery already loaded, just use that
define('jquery', function () {
return jQuery;
});
}
require(["jquery"], function ($) {
//This $ should be from the first jquery tag, and no
//double load.
});
requirejs(["../Content/Resources/smartmenus-1.1.0/jquery.smartmenus"], function () {
$(document).ready(function () {
$(".menu").on("loaded", function () {
$(function () {
/* add classes used by smartmenus */
$('#smartmenu>ul.menu').addClass("sm sm-mint");
/* remove Flare's "menu" class from menu proxy */
$('#smartmenu>ul.menu').removeClass("menu");
/* initialise smartmenus */
$('#smartmenu>ul.sm').smartmenus({
markCurrentItem: true,
markCurrentTree: true,
noMouseOver: true,
hideOnClick: false,
collapsibleBehavior: 'link',
showFunction: function($ul, complete) { $ul.fadeIn(250, complete); }
});
$("#smartmenu>ul.sm").smartmenus("itemActivate", $("#smartmenu").find("a.current").eq(-1));
});
});
});
});
Given how many problems there are, perhaps it’s not possible to use 1.1.0 in Flare. Alternatively, could I add the ‘link’ collapsible behaviour to 0.0.1?
Grateful for help.
Ian