Totally Zenned
- Join Date:
- Feb 2009
- Location:
- UK
- Posts:
- 1,326
- Plugin Contributions:
- 0
another on_load jscript question
Running v1.50 - on a local server, and read the following recommended resources to try and get 'on_load' to work:
Documents in the Zen Cart default install package.
docs/read_me_jscript.html
docs/read_me_onload.htmlAnd more in the wiki
Javascript
I have successfully added an image slider to the main page of my site by:
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> :
<script type="text/javascript">
$(window).load(function() {
$('#slider').nivoSlider();
});
</script>
and, included in html_header.php this 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>
I have left the external link to jquery.min.js whilst testing.
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:
<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>
deleted the code I had inserted in html_header.php and expected it to work. No joy
Any ideas as to what I have done wrong?