LT-275: Creating class and jQuery extension to make an element always stay inside another element boundaries

This commit is contained in:
Bruno Alves de Faria committed 2016-08-10 09:18:53 -03:00
1 parent 77de389bb8
commit 4acf844eb1
5 files changed
+198 -14

No files matched your search

@@ -24,6 +24,9 @@ Template.selectTree.onRendered(() => {
instance.component = component;
// Set the margin to display the common section
$treeRoot.children('.tree-content').css('margin-right', $treeRoot.width());
// Start the component transitions
$treeRoot.addClass('started');
@@ -96,8 +99,14 @@ Template.selectTree.onRendered(() => {
Template.selectTree.events({
'click .select-tree-root>.tree-content'(event, instance) {
// Get the tree root
const $treeRoot = $(event.currentTarget).closest('.select-tree-root');
// Detect the first interaction with the component and do the animation
$(event.currentTarget).parent().addClass('interacted');
$treeRoot.addClass('interacted');
// Remove the margin after the common section is closed
$treeRoot.children('.tree-content').css('margin-right', '');
},
'input .tree-search input'(event, instance) {