I have this javascript code that loads in the footer. I only need this javascript to load on a static home page, not on all other pages.
<script type="text/javascript">
var banner = (function(){
$('.banner').unslider({
speed: 1000, // The speed to animate each slide (in milliseconds)
delay: 999000, // The delay between slide animations (in milliseconds)
complete: function() {}, // A function that gets called after every slide animation
keys: false, // Enable keyboard (left, right) arrow shortcuts
dots: false, // Display dot navigation
fluid: true // Support responsive design. May break non-responsive designs
});
$( '#nav li:has(ul)' ).doubleTapToGo();
});
</script>
<script>
jQuery(document).ready(function() {
jQuery('.nav-toggle').click(function(){
//get collapse content selector
var collapse_content_selector = jQuery(this).attr('href');
//make the collapse content to be shown or hide
var toggle_switch = jQuery(this);
jQuery(collapse_content_selector).toggle(function(){
if(jQuery(this).css('display')=='none'){
toggle_switch.html('View All Services');//change the button label to be 'Show'
}else{
toggle_switch.html('Hide Services List');//change the button label to be 'Hide'
}
});
});
});
</script>
<script>
jQuery(document).ready(function() {
jQuery('.navtop-toggle').click(function(){
//get collapse content selector
var collapse_content_selector = jQuery(this).attr('href');
//make the collapse content to be shown or hide
var toggle_switch = jQuery(this);
jQuery(collapse_content_selector).toggle(function(){
if(jQuery(this).css('display')=='none'){
toggle_switch.html('Menu');//change the button label to be 'Show'
}else{
toggle_switch.html('Hide Menu');//change the button label to be 'Hide'
}
});
});
});
</script>
So far I have this php statement, but I'm having trouble wrapping it in this php code.
<?php if ($page=="home") echo " "; ?>
I'm not sure if putting the whole javascript code above is a good idea in the echo quotes. Is there an easier or better way of wrapping javascript in PHP?
Your help appreciated.