Code: Select all
<script type="text/javascript" src="/serendipity/templates/jquery.js"></script>
<script type="text/javascript">
jQuery.noConflict();
</script>
YL
Code: Select all
<script type="text/javascript" src="/serendipity/templates/jquery.js"></script>
<script type="text/javascript">
jQuery.noConflict();
</script>
Code: Select all
<script>
jQuery(document).ready(function() {
jQuery('body').html('Here we go.');
});
</script>
Erm. We wanted to drop using inline CSS and JS, remember?garvinhicking wrote:You can add jquery code simply anyplace in your template you like. Just use "jQuery(...)" instead of "$(...)".
Ah, that's the one thing I was missing. Thanks.garvinhicking wrote:just make sure your own .js reference comes after the eventdata placeholder for the <head>.
The jQuery bundled with s9y starting with v1.6 is included in the head – if I remember correctly to avoid compatibility issues with plugins using jQuery now which rely on it to be included in the head.Timbalu wrote:In my template I followed the boilerplate design to include all js stuff including jquery, except modernizr, in the very end just before closing body. I didn't recognize something did not work by now... What is the difference?
http://board.s9y.org/viewtopic.php?p=10424885Timbalu wrote:And how does Serendipity know/decide to use its own jquery?
Mh, I think it also auto-detects a manually included jQuery in the body, but I'm not sure about that. Test it or wait for Garvin to comment on this.Timbalu wrote:My head section does not have an automatically included serendipity jquery and I wasn't aware of $serendipity['capabilities']['jquery'] = false; until now.
I'm guessing some of onlis jQuery-enabled ones, livecomments etc. Some plugins seem to include style elements within the page (which I consider bad practice). So if the bundled jQuery was included before </body>, the plugin's script could be executed before jQuery was referenced.Timbalu wrote:Do you remember which plugins need it in the head? And why should they?
Yes, is does by grabbing serendipity_getTemplateFile('jquery.js').yellowled wrote:Mh, I think it also auto-detects a manually included jQuery in the body, but I'm not sure about that.
It is. It also is the latest jQuery version. Trust me, I know the person responsible for keeping it up to date in svn.Timbalu wrote:It'll better be a jquery.min.js, I think, as being included in every case.
No idea what you mean by BC, but jQuery is usually pretty backwards compatible. It might, however, of course always happen that scripts break following major jQuery updates. I'm afraid predicting that is beyond my current jQuery knowledge, but I'll make sure to read the jQuery ChangeLogs and keep you guys up to date.Timbalu wrote:So there is no need to further include it in the template... or do jquery versions break BC in their history?