Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. Feedback
  3. New Public js event should be added.

New Public js event should be added.

Scheduled Pinned Locked Moved Feedback
2 Posts 2 Posters 281 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    R
    rsepierre
    wrote on last edited by
    #1

    https://laytheme.com/documentation/custom-javascript.html

    The only event disclosed in the documentation is newpageshown. Which is good to modify behaviour on the page on existing elements.

    The only issue is that laytheme completely reprints the page every time the browser's size reaches a breakpoint. So all javascript changes / event listeners you could have made / bound to existing elements are gone.

    We should get one public event that announces that a layout has been finalized. Whether it's from a page load or from a sizechange.

    There is already a sizechanged event but it actually fires before the layout is changed. (I assume that it's the event used to trigger the layout change)

    window.laytheme.on("sizechanged", function () {
        console.log('sizechanged');
    });
    

    Those two events do not fire at all if you don't have a custom phone layout and I have not tested if it is fire before/after the new grid is fully printed :

    window.laytheme.on("switched_customphonelayout_to_desktoplayout", function () {
        console.log('switched_customphonelayout_to_desktoplayout');
    });
    
    window.laytheme.on("switched_desktoplayout_to_customphonelayout", function () {
        console.log('switched_desktoplayout_to_customphonelayout');
    });
    

    And I could not get those to fire either :

    window.laytheme.on("gridshown", function () {
        console.log('gridshown');
    });
    
    window.laytheme.on("overlayshown", function () {
        console.log('overlayshown');
    });
    
    window.laytheme.on("overlayhidden", function () {
        console.log('overlayhidden');
    });
    
    window.laytheme.on("transition_in", function () {
        console.log('transition_in');
    });
    
    window.laytheme.on("transition_navigation_out_completed", function () {
        console.log('transition_navigation_out_completed');
    });
    
    window.laytheme.on("before_content_replacement_for_project_overlay", function () {
        console.log('before_content_replacement_for_project_overlay');
    });
    
    window.laytheme.on("before_content_replacement", function () {
        console.log('before_content_replacement');
    });
    
    window.laytheme.on("transition_out", function () {
        console.log('transition_out');
    });
    
    window.laytheme.on("popstate", function () {
        console.log('popstate');
    });
    

    I think we should have one public event, in the documentation, that fires every time a new grid layout is fully printed, in all situations, not dependent on the reason of that change (whether it's a new page or a size change, custom layout or default layout, etc).

    1 Reply Last reply
    0
    • arminunruhA
      arminunruhA
      arminunruh
      Global Moderator
      wrote on last edited by
      #2

      can you try

      window.laytheme.on('content_ready', typeOfContentThatIsReady, $target, isProjectOverlayObj){
      
      }
      

      typeOfContentThatIsReady
      will be desktop or phone

      $target will be any containers that include gridder grids

      So all javascript changes / event listeners you could have made / bound to existing elements are gone.

      If you bind event listeners in a delegated way to document like described here:
      https://laytheme.com/documentation/custom-javascript.html#binding-click-events

      <script>
      jQuery(document).on("click", ".clickme", function(event) {
      	console.log("yay!");
      });
      </script>
      

      then no dom changes will alter these binds

      1 Reply Last reply
      0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      Online Users
      M
      michael_vvc
      C
      craigfeldspar
      Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
      laytheme.com
      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Recent
      • Tags
      • Popular
      • Users
      • Search