Dariune
07-12-2009, 12:21 PM
Hi all
Im new to javascript and decided to use Smooth navigational menu v1.3 as a menu for a page.
I have made the HTML external and put a <noscript> tag in the main page incase javascript is disabled.
The meny works great. Thankyou to the script writers :)
However, i have also created a slideshow (with my limited skill) which works fine on its own but when on the same page as the smooth menu the images appear (barring the 1st image) over the smooth menu.
I think this is because the menu is designed to take any script and dump its results into the menu's location (so as to place the menu HTML there)
The slideshow script is
var pots = [
{
"title":"This is a small image of the sample pan. <br /> A <a href='images/large.jpg' target='_blank'>larger image</a> is also available.",
"path":"images/small.jpg" },
{
"title":"Front view.",
"path":"images/front.jpg" },
{
"title":"Optional glass lid",
"path":"images/glasslid.jpg" },
{
"title":"Side elevation",
"path":"images/side.jpg"},
{
"title":"With standard lid",
"path":"images/withlid.jpg"},
{
"title":"Copper version",
"path":"images/copperfry.jpg"},
{
"title":"Green version",
"path":"images/greenfry.jpg"},
{
"title":"Red T2000 version",
"path":"images/redfry.jpg"}
];
var **** = 0
function slideShow() {
if (****>=pots.length)
****=0;
else if (****<0)
****=pots.length-1
document.images[0].src=pots[****]["path"];
var display = document.getElementById('title').innerHTML = pots[****]["title"];
};
And the HTML is
<div style="text-align:left; width: 330px;">
<h2>The 20 inch silver frying pan.</h2>
<p><img
onload="javascript:document.getElementById('title').innerHTML=pots[****]['title'];"
src="images/small.jpg" alt="The 20 inch silver frying pan." /></p>
<p id="title"> </p>
<p style="text-align:center"><a href="javascript:****--;slideShow();">Previous</a>
<a href="javascript:****++;slideShow();">next</a>
</p>
</div>
Before answering could i ask you to bear in mind that i am doing this as an assignment in a course. Therefore if you can think of ways to improve my slideshow script or any changes that should be made please do not tell me as that goes against the rules of the course.
Instead i am just asking if Smoothmenu can be changed to allow other scripts to function on the page. If of course i am right in thinking smoothmenu is the cause.
Many thanks in advance
Dariune
Im new to javascript and decided to use Smooth navigational menu v1.3 as a menu for a page.
I have made the HTML external and put a <noscript> tag in the main page incase javascript is disabled.
The meny works great. Thankyou to the script writers :)
However, i have also created a slideshow (with my limited skill) which works fine on its own but when on the same page as the smooth menu the images appear (barring the 1st image) over the smooth menu.
I think this is because the menu is designed to take any script and dump its results into the menu's location (so as to place the menu HTML there)
The slideshow script is
var pots = [
{
"title":"This is a small image of the sample pan. <br /> A <a href='images/large.jpg' target='_blank'>larger image</a> is also available.",
"path":"images/small.jpg" },
{
"title":"Front view.",
"path":"images/front.jpg" },
{
"title":"Optional glass lid",
"path":"images/glasslid.jpg" },
{
"title":"Side elevation",
"path":"images/side.jpg"},
{
"title":"With standard lid",
"path":"images/withlid.jpg"},
{
"title":"Copper version",
"path":"images/copperfry.jpg"},
{
"title":"Green version",
"path":"images/greenfry.jpg"},
{
"title":"Red T2000 version",
"path":"images/redfry.jpg"}
];
var **** = 0
function slideShow() {
if (****>=pots.length)
****=0;
else if (****<0)
****=pots.length-1
document.images[0].src=pots[****]["path"];
var display = document.getElementById('title').innerHTML = pots[****]["title"];
};
And the HTML is
<div style="text-align:left; width: 330px;">
<h2>The 20 inch silver frying pan.</h2>
<p><img
onload="javascript:document.getElementById('title').innerHTML=pots[****]['title'];"
src="images/small.jpg" alt="The 20 inch silver frying pan." /></p>
<p id="title"> </p>
<p style="text-align:center"><a href="javascript:****--;slideShow();">Previous</a>
<a href="javascript:****++;slideShow();">next</a>
</p>
</div>
Before answering could i ask you to bear in mind that i am doing this as an assignment in a course. Therefore if you can think of ways to improve my slideshow script or any changes that should be made please do not tell me as that goes against the rules of the course.
Instead i am just asking if Smoothmenu can be changed to allow other scripts to function on the page. If of course i am right in thinking smoothmenu is the cause.
Many thanks in advance
Dariune