javascript - Multiple jQuery plugins on multiple pages
My question may be very simple to most people on here. But i am very new to jQuery, and i am having a sort of difficulty with repetitiveness.
I have a custom script on a page which has a lot of text, that allows that text to be collapsed. This script is in jQuery. The page is in php. I have multiple pages like this. I find myself having to place the code for the script documents on every page like this:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="javascripts/readmore.min.js"></script>
<script src="javascripts/main_func.js"></script>
Is there a way that i can place it only on the index.php file and call the script function which is:
<script type="text/javascript">
$(document).ready(function(){
$('.article').readmore({maxHeight: 640});
});
</script>
Answer
Solution:
I am not sure how your page loads but this is what you would have to do essentially:
index.php
header.php
content.php
footer.php
If you have a new page, it would look something like this:
newpage.php