/* ----------------------------------------------------------------------------- * * File: /scripts/bulletin.js * Project: WaveTrack Website * Author: Dominique Kraus-Ahma - * Kraus-Ahma IT Consulting (dka@kraus-ahma.com) * Purpose: This script provides all specific java script handling for the template ''bulletin. * History: 15.01.2011 12:10:49 - file created (dk@) * * NOTES: * ----------------------------------------------------------------------------- */ $( document ).ready( function(){ /* -------------------------------------------------------------------------- */ // ---- Scroll Text ------------------------------------------------------------------------------------------------------------------------------------ /** * liScroll 1.0 * Examples and documentation at: * http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html * 2007-2010 Gian Carlo Mingati * Version: 1.0.2 (30-MARCH-2009) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * Requires: * jQuery v1.2.x or later * */ jQuery.fn.liScroll = function( settings ){ settings = jQuery.extend( {travelocity: 0.07}, settings ); return this.each( function(){ var $strip = jQuery( this ); $strip.addClass( 'newsticker' ); var stripWidth = 0; var $mask = $strip.wrap("
"); var $tickercontainer = $strip.parent().wrap("
"); var containerWidth = $strip.parent().parent().width(); //a.k.a. 'mask' width $strip.find( 'li' ).each( function( i ){ stripWidth += jQuery( this, i ).outerWidth( true ); // thanks to Michael Haszprunar } ); $strip.width( stripWidth ); var totalTravel = stripWidth + containerWidth; var defTiming = totalTravel / settings.travelocity; // thanks to Scott Waye function scrollnews( spazio, tempo ){ $strip.animate( {left: '-='+ spazio}, tempo, "linear", function(){ $strip.css( 'left', containerWidth ); scrollnews( totalTravel, defTiming ); }); } scrollnews( totalTravel, defTiming ); $strip.hover( function(){ jQuery( this ).stop(); }, function(){ var offset = jQuery( this ).offset(); var residualSpace = offset.left + stripWidth; var residualTime = residualSpace / settings.travelocity; scrollnews( residualSpace, residualTime ); }); } ); }; $( function(){ $( 'ul#ticker01' ).liScroll( {travelocity: 0.05} ); }); // ---- STOCK TICKER ----------------------------------------------------------------------------------------------------------------------------------- /** * Horizontal Stock Ticker for jQuery. * * @package jStockTicker * @author Peter Halasz * @license http://www.gnu.org/licenses/gpl-3.0.txt GPL v3.0 * @copyright (c) 2009, Peter Halasz all rights reserved. */ ( function( $ ){ $.fn.jStockTicker = function( options ){ if( typeof (options) == 'undefined' ){ options = {}; } var settings = $.extend( {}, $.fn.jStockTicker.defaults, options); var $ticker = $(this); settings.tickerID = $ticker[0].id; $.fn.jStockTicker.settings[settings.tickerID] = {}; var $wrap = null; if( $ticker.parent().get(0).className != 'wrap' ){ $wrap = $ticker.wrap( "
" ); } var $tickerContainer = null; if( $ticker.parent().parent().get(0).className != 'stocktickercontainer') { $tickerContainer = $ticker.parent().wrap( "
"); } var node = $ticker[0].firstChild; var next; while( node ){ next = node.nextSibling; if( node.nodeType == 3 ){ $ticker[0].removeChild( node ); } node = next; } var shiftLeftAt = $ticker.children().get(0).offsetWidth; $.fn.jStockTicker.settings[ settings.tickerID ].shiftLeftAt = shiftLeftAt; $.fn.jStockTicker.settings[ settings.tickerID ].left = 0; $.fn.jStockTicker.settings[ settings.tickerID ].runid = null; $ticker.width(2 * screen.availWidth); function startTicker(){ stopTicker(); var params = $.fn.jStockTicker.settings[settings.tickerID]; params.left -= settings.speed; if( params.left <= params.shiftLeftAt * -1 ){ params.left = 0; $ticker.append($ticker.children().get(0)); params.shiftLeftAt = $ticker.children().get(0).offsetWidth; } $ticker.css('left', params.left + 'px'); params.runId = setTimeout(arguments.callee, settings.interval); $.fn.jStockTicker.settings[settings.tickerID] = params; } function stopTicker(){ var params = $.fn.jStockTicker.settings[settings.tickerID]; if( params.runId) clearTimeout(params.runId); params.runId = null; $.fn.jStockTicker.settings[settings.tickerID] = params; } function updateTicker(){ stopTicker(); startTicker(); } $ticker.hover(stopTicker,startTicker); startTicker(); }; $.fn.jStockTicker.settings = {}; $.fn.jStockTicker.defaults = { tickerID :null, url :null, speed :1, interval :20 }; })( jQuery ); //$( function(){ // $( "#stockticker" ).jStockTicker( {interval: 45} ); //}); // ---- responsible function for hiding and showing the the ticker functionality // $( 'a.contracttype').click( function(){ var id = $(this).attr( 'id' ); $( '#contracttypebox' + id ).toggle(); $( '#li_' + id ).css( 'listStyle', 'url(\'/media/images/udbullet_open.gif\'' ); if( $( '#contracttypebox' + id ).css( 'display' ) == "none" ){ $( '#li_' + id ).css( 'listStyle', 'url(\'/media/images/udbullet_close.gif\'' ); } return false; } ); // $('a.contracttype').click $( '#contracttypebox' ).hide(); /* -------------------------------------------------------------------------- */ } );