Return to Snippet

Revision: 43801
at March 31, 2011 03:14 by orionrush


Initial Code
<?php if (!defined('SITE')) exit('No direct script access allowed');
/**
 * jquery backgrounder plugin
 *
 * @version 0.1
 * @author orionrush
 *
 * @use <plug:jsBackstreach img='<%bgimg%>', speed='150' />
 * 1. in the <head> of your template: ndxz-studio/site/your-template/index.php
 * 2. to prevent the image from being loaded twice in both the default backgrounder plugin and in this plugin
 * - remove <%bgimg%> from the <plug:backgrounder />
 */

function jsBackstreach($img='', $speed='')
{
	//nothing there!
	if ($img == '') return;
	//default speed is overwriten in plugin tag
	if ($speed == '') $speed = 150;

	$script = "<script type='text/javascript' src='". BASEURL . BASENAME . "/site/js/jquery.backstretch.min.js'></script>"."\n";
	$bg = "<script type='text/javascript'>"."\n"."$.backstretch('". BASEURL ."/files/$img', {speed: $speed});"."\n"."</script>"."\n";

	return $script.$bg;
}
?>

Initial URL

                                

Initial Description
This is a jquery full screen background image plugin for indexhibit using 
http://srobbin.com/jquery-plugins/jquery-backstretch/

Initial Title
backstretch for indexhibit

Initial Tags
plugin, jquery

Initial Language
PHP