Comments (2)
I found a way to detect that the particle instance is the first one on the page:
{% if gantry.config.index.particles.myParticle|keys|first == id %}
{{ 'This first my Particle: ' ~ id }}
{% endif %}
Now the question to the connoisseurs is this the right way? And is there a better solution?
from gantry5.
So, I found a solution that suits me. And this solution is in the documentation:
https://docs.gantry.org/gantry5/advanced/css-js-twig
{% pageblock body_top %}
<div class="MyModalBlock"></div>
{% endpageblock %}
This way, only one instance is loaded <div class="MyModalBlock"></div>
, even if there are multiple instances of the same particle on the page.
from gantry5.
Related Issues (20)
- An exception has been thrown during the rendering of helium template HOT 1
- How To Override Gantry5 pagination classes HOT 1
- Bug: Copyright particle misformats output HOT 2
- Uncaught TypeError: e.indexOf HOT 1
- Gantry class not appearing on the frontend
- 8192 preg_replace_callback(): Passing null to parameter #3 HOT 2
- Page Class not Loading on Category Blog Menu Items HOT 3
- Persistent Unchecking of 'Disable Dropdowns' in Gantry 5 Menu Settings After Joomla Menu Edit HOT 3
- two different rem units for @media and else HOT 1
- Changelog wrong in 5.5.17
- Gantry 5.5.17, Hydrogen 5.5.17: how to disable "mobile" layout HOT 1
- Uncaught TypeError: jQuery(...).spectrum is not a function
- Gantry 5 SCSS compiler has issues with mixed units when using clamp()
- Empty file custom_xy.css generated, even if custom.scss does not exist in /templates/g5_helium/custom/scss
- Empty tag (<span class="g-social-text"></span>) is generated, even if the social icon text is empty HOT 4
- Class "Twig\Environment" not found HOT 1
- Particle Joomla article - Joomla 5 - Error on previous/next button HOT 2
- SCSS compile error after upgrading to 5.5.17 HOT 6
- Crash Gantry/Component/Twig/TwigExtension.php HOT 1
- Incompatibility error between hydrogen theme, wpforms and the server.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gantry5.