...

View Full Version : Adding Breadcrumbs to Coda Slider



rcouser
03-20-2009, 11:47 AM
Hello there,
I am working on a Coda Slider Effect (http://jqueryfordesigners.com/coda-slider-effect/) but i'm having one issue with trying to implement a breadcrumb outside of the slider div.

Is there a way to use window.location.hash to display a different breadcrumb location. eg Home > About Us or Home > Services.

I understand PHP statement but just can't transfer the logic to Javascript, here is an example of what I'm trying to do but I understand echo doesn't work in Javascript


var page = location.hash;
switch(page)
{
case "#home":
echo '<li>Home</li>';
break;
case "#about":
echo '<li>Home</li><li>About<li>/';
break;
case "#contact":
echo '<li>Home</li><li>Contact<li>/';
break;
default:
echo '<li>Home</li>';
}


Any help would be great. Thanks in advance, Ryan

Philip M
03-20-2009, 12:16 PM
Try searching this forum for breadcrumbs.

rcouser
03-20-2009, 01:27 PM
Hey Philip,
I tried searching but everything was for PHP.
I had another go but still no luck.


<script type="text/javascript">
var page = location.hash;
switch(page){
case "#home":
pageurl = '<li>Home</li>';
break;
case "#about_us":
pageurl = '<li><a href="#home">Home</a> /</li><li>About Us</li>';
break;
case "#our_brands":
pageurl = '<li><a href="#home">Home</a> /</li><li>Our Brands</li>';
break;
case "#international":
pageurl = '<li><a href="#home">Home</a> /</li><li>International</li>';
break;
case "#our_news":
pageurl = '<li><a href="#home">Home</a> /</li><li>Our News</li>';
break;
case "#get_in_touch":
pageurl = '<li><a href="#home">Home</a> /</li><li>Get in Touch</li>';
break;
default:
pageurl = '<li>Home</li>';}
document.write(pageurl);
</script>

Regards

Philip M
03-20-2009, 02:52 PM
JavaScript cannot actively read variables from the server, but when a page loads, PHP can pass variables to JavaScript by writing to the page the JavaScript is on.



<script type="text/javascript">
<!--
<?php
echo("firstVar = $var1;");
echo("secondVar = $var2;");
?>
// -->
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum