jQuery click to open menus

<script type="text/javascript">
jQuery(document).ready(function(){
frCurrentOpenMenuId = false;
jQuery('#mobile-nav a[href="#"]').click(function(event){
var parent = jQuery(this).parent().attr('id');
if(frCurrentOpenMenuId == parent){
jQuery('#' + parent).removeClass('submenu-open');
frCurrentOpenMenuId = false;
}
else{
jQuery('.menu-item-has-children').removeClass('submenu-open');
jQuery('#' + parent).addClass('submenu-open');
frCurrentOpenMenuId = parent;
event.preventDefault();
event.stopPropagation();
}
});
jQuery(document).click(function(){ jQuery('.menu-item-has-children').removeClass('submenu-open'); frCurrentOpenMenuId = false; });
});
</script>

Floating Back to Top

//Call like this:

<?php ter_back_to_top(900,600) ?>

//The Function

/* Back to Top */
function ter_back_to_top($offset = 220, $duration = 500){?>
<a href="#" class="back-to-top rounded-5"><img src="<?php echo TER_CHILD_GRAPHICS ?>top.png" alt="back to top"></a>
<script type="text/javascript">
jQuery(document).ready(function(){
var offset = <?php echo $offset ?>;
var duration = <?php echo $duration ?>;
jQuery(window).scroll(function(){
if(jQuery(this).scrollTop() > offset) jQuery('.back-to-top').fadeIn(duration);
else jQuery('.back-to-top').fadeOut(duration);
});
jQuery('.back-to-top').click(function(event){
event.preventDefault();
jQuery('html,body').animate({scrollTop: 0},duration);
return false;
})
});
</script>
<?php
}

Rotator, quote or whatever

<div id="hypfb-quote-item-1" class="hypfb-quote-item none">Quote Here</div>
<div id="hypfb-quote-item-2" class="hypfb-quote-item none">Quote 2 Here</div>
<img src="" onmouseover="hypfb_rotate_quote(1);" alt="">
<img src="" onmouseover="hypfb_rotate_quote(2);" alt="">

<script type="text/javascript">
function hypfb_rotate_quote(id){
if(currentQuote == '#hypfb-quote-item-' + id) return;
jQuery(currentQuote).stop(true).fadeOut(function(){
currentQuote = '#hypfb-quote-item-' + id;
jQuery(currentQuote).fadeIn();
});
}
</script>

Fake dropdown for a list

<h2>Shop by Brand</h2>

<a id="brandsButton">Select a Brand</a>
<div id="brandsPanel" style="display: none;">
<div class="BlockContent">
<ul>
<li>item 1</li>
<li>item 2</li>
</ul>
</div>
</div>

<script type="text/javascript">
$(document).ready(function(){
$("div#brandsPanel").hide(); $("#brandsButton").click(function () { $("div#brandsPanel").slideToggle("normal"); });
});
</script>

Simple jQuery News Ticker

$(document).ready(function() {
var ticker = function()
{
setTimeout(function(){
$('#recent-posts li:first').animate( {marginTop: '-120px'}, 800, function()
{
$(this).detach().appendTo('ul#recent-posts').removeAttr('style');
});
ticker();
}, 4000);
};
ticker();
});

Flowplayer Overlay

<a
href="http://TYPETHEVIDEOURLHERE"
style="display:block;width:500px;height:400px"
id="player">
</a>

<script type="text/javascript">

//Create Player and Overlay
jQuery(function() {

//Player
var player = $f("player", "/flowplayer/flowplayer-3.2.4.swf", {
clip: {
autoPlay: true,
autoBuffering: true,

//Close overlay when play complete
onFinish: function() {
jQuery('.close').click();
}
}
});

//Overlay
jQuery("img[rel]").overlay({

top: "center",

onClose: function() {
player.pause();
}
});

});
</script>

Jquery simple rollover

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<!-- Load jQuery -->
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery","1.3.2");
</script>

</head>
<body>

<!-- jQuery Rollover -->
<script type="text/javascript">
jQuery(document).ready(function() {

$("img.rollover").hover(
function()
{
this.src = this.src.replace("_off","_on");
},
function()
{
this.src = this.src.replace("_on","_off");
}
);

});
</script>

<a href="http://hyperspatial.com"><img class="rollover" src="graphics/go_btn_off.png" width="60" height="21" alt="Button1" /></a>

<a href="http://hyperspatial.com"><img class="rollover" src="graphics/go_btn_off.png" width="60" height="21" alt="Button2" /></a>

</body>
</html>