Topic Closed
juergen
1.4K Posts
50.2K 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)
3 years ago#8731

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

Definitely needed. How does this look?

3 years ago#8742

juergen
1.4K Posts
50.2K 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?

3 years ago#8746

juergen
1.4K Posts
50.2K 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.
3 years ago#8747

juergen
1.4K Posts
50.2K 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 );
  }
});
3 years ago#8748

Topic Closed

 

News

Typesetter 5.1
8/12/2017

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

Over 8 Times Faster Than Wordpress
5/3/2016

We've known for a long time that Typesetter is fast. It's something we take pride ... Read More

More News

creisi productions

Dienstleistungen von creisi productions, Luzern (Schweiz): * Konzeption, Planung und Erstellung Ihres Internet-Auftritts * Betreuung und Aktualisierung/Pflege Ihrer Website * ...

Find out more about our Provider Spotlight

Log In

  Register