We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21417
    • 486 Posts
    Hello,

    I am using MODx evo 1.0.6.

    I have got 3 buttons in a chunk which when clicked scroll to the various elements on a page (eg photos, pdfs, enquiry).

    Is there a way to somehow only insert the chunk on pages where the container div (#content) is greater than or equal to 420px?

    eg

    insert {{buttons}} ONLY if #content pixel height is greater than or equal to 420px???
      Web design Adelaide
      http://gocreate.com.au
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The server has no way of knowing the dimensions of the DOM elements in the browser. You would have to build the whole thing in Javascript to do something like that, or use Javascript to calculate the size of the DOM element and use AJAX to load the chunk.

      If I understand correctly that you only want the buttons to show if the items linked to are below the bottom of the browser window, then you would need to actually calculate the height of the browser window and determine the location of the content within that window.

      if ($("#elementOne").position().top > $("body").height()){ ...
      
      [ed. note: sottwell last edited this post 14 years, 5 months ago.]
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 21417
        • 486 Posts
        Ah I see, I thought it might be a js thing but was hoping my old friend phx could come to the rescue.

        Looks like plan B then for me!

        Thanks for the outline, that makes sense.

        Have a great day.
          Web design Adelaide
          http://gocreate.com.au