Originally Posted by
lankeeyankee
Could this benefit from a template based autoloader that has a define for which pages a certain amount of js and css scripts load? I am not sure I understand the issue, so I might be off-base with my suggestion. But we use multiple jquery scripts that are called depending on which page is called and none of them conflict with each other.
This isn't about conflicts - but about using jquery files with document ready statements. This code goes in the header (sometimes in the footer):
Code:
<script type="text/javascript">
$(document).ready(function() {
var origsrc = $("#productMainImage a img").attr("src");
........
.......................
}
);
});
</script>
Not uncommon to run 2 jquery scripts at the same time, so you add in the other inside the $(document).ready(function() { statement.
What I"m trying to do is to automate that so that no one has to figure out how to add that in or change the html_header. Kinda like adding in another css file but would be done through activation in admin.
This gives the user more control as well since those ready doc statements can do things like change the speed or color of something in the jquery.
This is the norm for jquery. Of course all of that can be done within the jquery file itself but if I can make this work then almost any jquery mod can be easily plugged into Zen Cart. That opens up a lot of possibilities for the community.
Just trying to make it more user friendly since I seem to be creating more and more of these kind of plugins. Selfishly, this would also reduce the amount of support necessary for such plugins!
Also, sometimes a jquery will be needed on every page - don't forget that. It's not about which page to include it on. But how to add in another one later.
Bookmarks