Different scripts for different pages? #46
Answered
by
PaperStrike
HEIGE-PCloud
asked this question in
Q&A
|
A similar question MoOx/pjax#230 I want to have different For example, I have <script src="pjax.js"></script>
<script src="theme.js"></script>on page 1, and And I have <script src="lightgallery.js"></script>
<script src="pjax.js"></script>
<script src="theme.js"></script>on page 2, which I want to call |
Answered by
PaperStrike
Jul 14, 2021
Replies: 1 comment
|
The easiest solution would be wrapping the parts that differ among pages into an element that you will add to the <!-- page 1 -->
<div class="differ-among-pages"></div>
<script src="pjax.js"></script>
<script src="theme.js"></script>
<!-- page 2 -->
<div class="differ-among-pages">
<script src="lightgallery.js"></script>
</div>
<script src="pjax.js"></script>
<script src="theme.js"></script>don't forget to select that element like: const pjax = new Pjax({
selectors: [
'.differ-among-pages',
],
});#31 (comment) shows two other possible solutions. |
0 replies
Answer selected by
HEIGE-PCloud
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The easiest solution would be wrapping the parts that differ among pages into an element that you will add to the
selectorsoption. Make sure to have the wrapper existing on each page. In your example, that could bedon't forget to select that element like:
#31 (comment) shows two other possible solutions.