Topic Closed
juergen
1.5K Posts
53.7K Downloads
16 Plugins
design, web development & visual effects
Is there already a JS event triggered when a new section is added to the content?
If not, it would come in handy for section types that need some JS initialization to show/work properly (Responsive Image, Parallax Image, Slider Factory et al)
4 years ago#8731

Josh S.
2K Posts
280K Downloads
16 Themes
18 Plugins

Definitely needed. How does this look?

4 years ago#8742

juergen
1.5K Posts
53.7K Downloads
16 Plugins
design, web development & visual effects

How does this look?

Should work. So we could init the new section in a section's runtime JS...

/* init newly added Section */
$(document).on("SectionAdded", ".filetype-my_Custom_Section_Type", function() {
  my_Custom_Section_Init_Function( $(this) );
});

Or is there a better way without delegatiing the event?

4 years ago#8746

juergen
1.5K Posts
53.7K Downloads
16 Plugins
design, web development & visual effects
I wonder how to deal with this best in case a SectionCombo is added, where the "SectionAdded" event will fire on the wrapper object....? Hmmm.
4 years ago#8747

juergen
1.5K Posts
53.7K Downloads
16 Plugins
design, web development & visual effects

Ok, works

// init Section in newly created Section Combo
$(document).on("SectionAdded", ".filetype-wrapper_section", function() {
  var NewCustomSection = $(this).find(".filetype-my_Custom_Section_Type");
  if ( NewCustomSection.length > 0 ){
    my_Custom_Section_Init_Function( NewCustomSection );
  }
});
4 years ago#8748

Topic Closed

 

News

elFinder 2.1.50 in Upcoming Release
12/28/2019

A new release for Typesetter is in the works with a lot of improvements including the ... Read More

Typesetter 5.1
8/12/2017

Typesetter 5.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

More News

HH-Support

Company located in T├│rshavn, Faroe Islands. * Webpage Design * Consultant & Provider of a wide range of programs for visually impaired and dyslextics.

Find out more about our Provider Spotlight

Log In

  Register