Running v1.50 - on a local server, and read the following recommended resources to try and get 'on_load' to work:
I have successfully added an image slider to the main page of my site by:Documents in the Zen Cart default install package.
docs/read_me_jscript.html
docs/read_me_onload.html
And more in the wiki
Javascript
adding jscript_jquery.nivo.slider.js into includes\templates\MY_TEMPLATE\jscript folder
adding stylesheet_nivo-slider.css into includes\templates\MY_TEMPLATE\css folder
added a <div> in tpl_main_page.php calling up the images to use in the slider (probably shouldn't have used this file but included 'if($this_is_home_page)', and it seemed a good idea at the time).
added the following code, after the above <div> :
and, included in html_header.php this codeCode:<script type="text/javascript"> $(window).load(function() { $('#slider').nivoSlider(); }); </script>
I have left the external link to jquery.min.js whilst testing.PHP Code:<link rel="stylesheet" href="stylesheet_nivo-slider.css" type="text/css" media="screen" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="jscript_jquery.nivo.slider.js" type="text/javascript"></script>
All seems to work ok.
Rather than having the code in html_header.php I wanted to use the on_load system. So I created a file on_load_nivo.slider.js in includes\templates\MY_TEMPLATE\jscript\on_load\ folder with exactly the following code:
deleted the code I had inserted in html_header.php and expected it to work. No joyCode:<link rel="stylesheet" href="stylesheet_nivo-slider.css" type="text/css" media="screen" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script src="jscript_jquery.nivo.slider.js" type="text/javascript"></script>
Any ideas as to what I have done wrong?


Reply With Quote
