Page 1 of 1
JQuery ready function location
Posted: Wed May 12, 2010 12:57 pm
by jenn.bohm
I want to use the jQuery sIFR plugin to display the product name on Product3.aspx, which uses the document ready function to replace the content of a particular div with a swf displaying the text.
I have tried putting this function in several places, including the head section of Scriptlet.master and in App_Data\Scriptlets\Custom\Content\Show Product 1.htm, but it doesn't seem to be executing.
I'm sure that the solution is something very simple, but I'm just not finding it.
Re: JQuery ready function location
Posted: Wed May 12, 2010 1:00 pm
by michael.p.larsen
I added all my onload stuff to the Header area of the Standard Header scriptlet. Works great.
Re: JQuery ready function location
Posted: Wed May 12, 2010 1:16 pm
by jenn.bohm
Hmm, it didn't work for me. We have a custom header scriptlet, and I put this at the very top of our header scriptlet:
<script type="text/javascript">
$(document).ready(function()
{
$('#ProductTitle').sifr({ build: 436, version: 3, path: 'Resources/', font: 'Futura-Condensed-Bold', color: '#000000', save: true });
});
</script>
But, it's not executing for me.
I can put a plain alert inside the script tags in the same spot, and it executes, but as soon as I put in a document ready function, it doesn't happen.
Re: JQuery ready function location
Posted: Wed May 12, 2010 1:31 pm
by dappy2
I have all mine load in the ScriptManager on the master pages and moved all jquery functions to an external Javascript file:
Code: Select all
<ajax:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
<Scripts>
<ajax:ScriptReference Path="~/js/WebKitFix.js" />
<ajax:ScriptReference Path="~/js/common.js" />
<ajax:ScriptReference Path="~/js/jquery-1.3.2.min.js" />
<ajax:ScriptReference Path="~/js/custom.js" />
</Scripts>
</ajax:ScriptManager>
Re: JQuery ready function location
Posted: Wed May 12, 2010 1:33 pm
by michael.p.larsen
Add the script src for the sIFR files and jQuery to the header, BEFORE the ready function. This is what I have:
Code: Select all
<script type="text/javascript" src="js/fancybox/jquery.mousewheel-3.0.2.pack.js"></script>
<script type="text/javascript" src="js/fancybox/jquery.fancybox-1.3.1.js"></script>
<link rel="stylesheet" type="text/css" href="js/fancybox/jquery.fancybox-1.3.1.css" />
<script src="js/jquery.lazyload.mini.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(function() {
$("img").lazyload({
placeholder : "images/grey.gif",
failurelimit : 5000
});
});
</script>
Re: JQuery ready function location
Posted: Tue May 18, 2010 7:59 am
by jmestep
Jenn- if there is nVelocity code on the scriplet using the $, you might have to use jQuery instead of $. We ran into that in one place.