Jump to content

jQuery placement


tutmeister

Recommended Posts

I'm developing a skin and am having trouble displaying all the content that relies on jQuery correctly. I have everything working perfectly in a static file, but when I break it up to go into templates is where it goes wrong.

Essentially, what I've narrowed it down to is if I don't call jQuery in both the layout.tpl and core_htmlhead.tpl the elements replying on jQuery fail gracefully as designed. But obviously I shouldn't have to be calling jQuery twice...so has anyone encountered this before?

Link to comment
Share on other sites

Kyle, I know I shouldn't be calling it twice, hence the post. I have tried it in both locations and the only time my jquery elements behave correctly is when I call it from both locations. I will have to use firebug to track down why this is happening if no one else has this issue, as it's obviously something to do with the way my skin is coded.

Link to comment
Share on other sites

Guest lorathon

I thought that the layout.tpl made the core_html files obsolete. What happens if you just have the jQuery call in the layout template? I do not use the layout template but I seem to remember something about this.

Link to comment
Share on other sites

2 out of 3 items that rely on jQuery stops working if I do that Jeff. After some fault-finding, I'm even more baffled: If I remove all JS calls from layout.tpl and just put them in core_htmlhead.tpl nothing works. But if I then then call the jQuery and jQueryUI a second time within core_htmlhead.tpl, right below each other, it all works fine. Like this:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>

I moved everything else below them just to make sure it wasn't a dependency issue and it still displayed the same behavior. So obviously there is something wrong and I need a break! I will likely start fresh with a working HTML-only template, moving it into phpVMS bit by bit to determine the problem. I haven't experienced this before.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...