Online Page Editor Add-on Support Product Page
How to avoid jQuery conflict
Asked 09 Apr 2015 13:46:12
1
has this question
09 Apr 2015 13:46:12 Tim Dittmer posted:
I want to use the Online Page Editor and DMX Accordion on a single page but I can only get one or the other to work - not both. The Online Editor is pulled into the page via a PHP includes statement. I realize I cannot have 2 calls for jQuery in one document so I am trying to determine how to resolve this.The content the client can update is on a separate page and has to have the jQuery so how can I get the Accordion to work that needs jQuery as well? I am not a programmer so this is beyond what I can understand...
Thanks!
Replies
Replied 14 Apr 2015 09:22:38
14 Apr 2015 09:22:38 Teodor Kuduschiev replied:
Hello Tim,
Could you please explain a little more detailed how exactly and what exactly are you including on which page?
Could you please explain a little more detailed how exactly and what exactly are you including on which page?
Replied 14 Apr 2015 13:08:42
14 Apr 2015 13:08:42 Tim Dittmer replied:
Hi Teodor,
the main page is here: edmonds.ca/News.php
The paragraph below "Most recent announcemtns" (above Archived news) is pulled into the page via an INCLUDE file:
<div class="dmxAccordion" id="dmxAccordion1">
<h3> <a href="#dmxAccordion1-1">Most Recent Announcements</a></h3>
<div id="dmxAccordion1-1">
<?php include 'INCLnewsBrief.php'; ?>
</div>
<h3> <a href="#dmxAccordion1-2">Archived News</a></h3>
<div id="dmxAccordion1-2">
<h4>.: 2013</h4>
<p>Thirty years with the BBB
Sarah Edmonds-Gray and Sandy Snide prou ......
The blue links "most recent announcements" and "Archived news" are accordion panels that are not working because the INCLUDE file: edmonds.ca/INCLnewsBrief.php already contains jQuery.
If I removed the jQuery from /INCLnewsBrief.php the Accordion would work. If I remove the jQuery from News.php, the INCLUDES file would work but I cannot get them to work at the same time so think I need to do something with where the jQuery is loaded. I also found scripts online that prevented jQuery from being loaded more than once but I could not figure out how to use it
Please help.
Thanks,
Tim
the main page is here: edmonds.ca/News.php
The paragraph below "Most recent announcemtns" (above Archived news) is pulled into the page via an INCLUDE file:
<div class="dmxAccordion" id="dmxAccordion1">
<h3> <a href="#dmxAccordion1-1">Most Recent Announcements</a></h3>
<div id="dmxAccordion1-1">
<?php include 'INCLnewsBrief.php'; ?>
</div>
<h3> <a href="#dmxAccordion1-2">Archived News</a></h3>
<div id="dmxAccordion1-2">
<h4>.: 2013</h4>
<p>Thirty years with the BBB
Sarah Edmonds-Gray and Sandy Snide prou ......
The blue links "most recent announcements" and "Archived news" are accordion panels that are not working because the INCLUDE file: edmonds.ca/INCLnewsBrief.php already contains jQuery.
If I removed the jQuery from /INCLnewsBrief.php the Accordion would work. If I remove the jQuery from News.php, the INCLUDES file would work but I cannot get them to work at the same time so think I need to do something with where the jQuery is loaded. I also found scripts online that prevented jQuery from being loaded more than once but I could not figure out how to use it
Please help.
Thanks,
Tim
Replied 14 Apr 2015 13:14:58
14 Apr 2015 13:14:58 Teodor Kuduschiev replied:
Well, you cannot include the pages like that...
All of the:
<script> ...</script> and <link rel="stylesheet"... /> should be in the <head> tags of the page.
All of the:
<script> ...</script> and <link rel="stylesheet"... /> should be in the <head> tags of the page.
Replied 14 Apr 2015 13:46:04
14 Apr 2015 13:46:04 Tim Dittmer replied:
I was pretty sure I messed up but I cannot figure out how to correct this. I just wrapped the code inside a Head element but that does not make a difference.
Here is what I want to do: The "Most recent announcements" are to be displayed on all pages, the reason I thought using include was the best way to do this. Can you please offer me suggestions how to accomplish this and ensure the Accordion still works? Is there a better/cleaner way to do this?
I love your extensions but now I have to find a way to make the work together on the same page.
Thanks
Here is what I want to do: The "Most recent announcements" are to be displayed on all pages, the reason I thought using include was the best way to do this. Can you please offer me suggestions how to accomplish this and ensure the Accordion still works? Is there a better/cleaner way to do this?
I love your extensions but now I have to find a way to make the work together on the same page.
Thanks
Replied 14 Apr 2015 14:16:32
14 Apr 2015 14:16:32 Teodor Kuduschiev replied:
If you need to use any extension as an include, you need to:
1. Add it to an empty page
2. Cut the includes that are inside the head tags and place it in a separate EMPTY (absolutely no other code in code view) page OR paste it directly on the main page(s).
3. Cut the extension code, that is inside the body tags and and place it in a separate EMPTY (absolutely no other code in code view) page, that later you include on your main page(s).
1. Add it to an empty page
2. Cut the includes that are inside the head tags and place it in a separate EMPTY (absolutely no other code in code view) page OR paste it directly on the main page(s).
3. Cut the extension code, that is inside the body tags and and place it in a separate EMPTY (absolutely no other code in code view) page, that later you include on your main page(s).
Replied 14 Apr 2015 14:20:00
14 Apr 2015 14:20:00 Tim Dittmer replied:
Thank you Teodor for your help.
May I contact you again if I get stuck?
May I contact you again if I get stuck?