I want to fetch the data in miniTitle to a javascript file I trigger from the theme.
I have adjusted the vanilla.js file and I want to add the {{{miniTitle}}} which is set in the contentObject Json.
How is this done?
Danne/
I want to fetch the data in miniTitle to a javascript file I trigger from the theme.
I have adjusted the vanilla.js file and I want to add the {{{miniTitle}}} which is set in the contentObject Json.
How is this done?
Danne/
Hi Danne,
Depending on where you want your mini-title to show up, you'll probably want to have a look in the page.hbs template file.
My problem is that I cant get the miniTitle (Chapter 1-2-3-4) info into a variable in a theme vanilla.js.
If I create a var in the theme js file it dosen´t recognizie the info in {{{miniTitle}}}.
Somewere I need a reference to the contentObject.json file into the javascript file!
D
The triple brackets is a Handlebars thing, so won't do anything in plain JS. You can access any model information using dot notation though (e.g. model.miniTitle).
What is it that you're trying to do?
See this page for some help with the core events: https://github.com/adaptlearning/adapt_framework/wiki/Core-Events
I got this function to work with:
Adapt.on('pageView:ready', function(view) {$(".sub_menu").empty();
titel = view.model.title;
$(".sub_menu").append("<div class=\"page sidebar_title\"><strong><h4>"+titel+"</h4></strong></div>");
}
I have shortened a little!
But I get undefined for the titel variable!
D