/* * Akkordeon-Effekte * Hängt ab von enquire.js, http://bit.ly/OHb0zR * Taquiri GmbH & Co. KG, Tim Kaufmann, tk@taquiri.de * * Container: .acc * Knopf für Toggle: .acc > .acc-toggle * Balg des Akkordeons: .acc > .acc-bellow * * Das Verhalten des Akkordeons wird über Klassen des Containers konfiguriert: * * .acc Muss * - Muss, damit überhaupt etwas passiert. Dient zugleich als Namespace. * * .acc-bp-{n}-(coll|exp|off) Muss * - Legt das Verhalten (collapsed, expanded oder off) bei Erreichen des jeweiligen * Breakpoints fest. Verändert sich die Breite des User-Agents (bspw. durch * Windows-Resize oder Smartphone-Rotation), müssen entsprechende Aufrufe von * accUpdate() über enquire.js getriggert werden. * * .acc-close-(none|siblings) Optional * - Ohne diese Klasse führt Klick auf ein .acc-toggle immer dazu, dass alle * anderen Akkordeons auf der Seite geschlossen werden. Ein eventuelles Eltern- * Akkordeon des Akkordeons, zu dem der geklickte Toggle gehört, wird dabei * ignoriert, weshalb wir die Akkordeons auch verschachteln können. * none: alle anderen Akkordeons bleiben unverändert * siblings: nur Geschwister-Akkordeons werden geschlossen * * .acc-scroll-(on|off) Optional * - Ohne diese Klasse wird bei Ausfahren eines Akkordeons immer so gescrollt, dass * dessen Oberkante möglichst nah an der Oberkante des User Agents liegt. * off: Kein Scrollen */ function accData($el) { var $r = []; var $parameterList = []; var $breakpoints = {}; if ($el.hasClass('acc')) { $r.container = $el; } else { $r.container = $el.closest('.acc'); } $r.toggle = $('.acc-toggle:first', $r.container); $r.bellow = $('.acc-bellow:first', $r.container); var $classList =$r.container.attr('class').split(/\s+/); $.each( $classList, function(index, $item){ if ($item.indexOf("acc-bp-") != -1) { $parameterList = $item.split('-'); $breakpoints[$parameterList[2]] = $parameterList[3]; } else if ($item.indexOf('acc-close-') != -1) { $parameterList = $item.split('-'); $r.close = $parameterList[2]; } $parameterList.length = 0; }); $r.breakpoints = $breakpoints; return $r; } function accUpdate($coll, $currentBreakpoint) { $coll.each(function() { $el = $(this); $a = accData($el); $newState = $a.breakpoints[$currentBreakpoint]; switch ($newState) { case 'off': if ($a.container.hasClass('is-acc-coll') || $a.container.hasClass('is-acc-exp')) { accDisable($a); } break; case 'coll': if ($a.container.hasClass('is-acc-exp')) { accCollapse($a); } else if (!$a.container.hasClass('is-acc-coll')) { accEnable($a); accCollapse($a); } break; case 'exp': if ($a.container.hasClass('is-acc-coll')) { accExpand($a, true); } else if (!$a.container.hasClass('is-acc-exp')) { accEnable($a); accExpand($a, true); } break; default: log('Akkordeon: Kein Zustand definiert für ' + $a.toggle.html()); } }) } function accDisable($a) { $a.toggle.off('click'); accExpand($a, true); $a.container .removeClass('is-acc-exp') .removeClass('is-acc-coll'); } function accEnable($a) { $a.toggle.on('click', accToggle); } function accExpand($a, $noscroll) { $noscroll = $noscroll || false; switch ($a.close) { case 'siblings': var $mustCollapse = $a.container.siblings('.is-acc-exp') break; case 'none': var $mustCollapse = $(); break; default: var $mustCollapse = $('.is-acc-exp').not($a.container.parents()); } $mustCollapse.each(function() { accCollapse(accData($(this))); }) $a.bellow.slideDown('fast', function() { if (!$a.container.hasClass('acc-scroll-off') && $noscroll == false) { if ($.browser.opera) { var $target = 'html'; } else { var $target = 'html,body'; } $($target).animate({ scrollTop: ($a.container.offset().top - 10) }, 1000); } }); $a.container .addClass('is-acc-exp') .removeClass('is-acc-coll'); } function accCollapse($a) { $a.bellow.slideUp('fast'); $a.container .removeClass('is-acc-exp') .addClass('is-acc-coll'); } function accToggle(event) { event.preventDefault(); $acc = accData($(this)); if ($acc.container.hasClass('is-acc-exp')) { accCollapse($acc); } else if ($acc.container.hasClass('is-acc-coll')) { accExpand($acc); } } ;(function(f,h,$){var a='placeholder' in h.createElement('input'),d='placeholder' in h.createElement('textarea'),i=$.fn,c=$.valHooks,k,j;if(a&&d){j=i.placeholder=function(){return this};j.input=j.textarea=true}else{j=i.placeholder=function(){var l=this;l.filter((a?'textarea':':input')+'[placeholder]').not('.placeholder').bind({'focus.placeholder':b,'blur.placeholder':e}).data('placeholder-enabled',true).trigger('blur.placeholder');return l};j.input=a;j.textarea=d;k={get:function(m){var l=$(m);return l.data('placeholder-enabled')&&l.hasClass('placeholder')?'':m.value},set:function(m,n){var l=$(m);if(!l.data('placeholder-enabled')){return m.value=n}if(n==''){m.value=n;if(m!=h.activeElement){e.call(m)}}else{if(l.hasClass('placeholder')){b.call(m,true,n)||(m.value=n)}else{m.value=n}}return l}};a||(c.input=k);d||(c.textarea=k);$(function(){$(h).delegate('form','submit.placeholder',function(){var l=$('.placeholder',this).each(b);setTimeout(function(){l.each(e)},10)})});$(f).bind('beforeunload.placeholder',function(){$('.placeholder').each(function(){this.value=''})})}function g(m){var l={},n=/^jQuery\d+$/;$.each(m.attributes,function(p,o){if(o.specified&&!n.test(o.name)){l[o.name]=o.value}});return l}function b(m,n){var l=this,o=$(l);if(l.value==o.attr('placeholder')&&o.hasClass('placeholder')){if(o.data('placeholder-password')){o=o.hide().next().show().attr('id',o.removeAttr('id').data('placeholder-id'));if(m===true){return o[0].value=n}o.focus()}else{l.value='';o.removeClass('placeholder');l==h.activeElement&&l.select()}}}function e(){var q,l=this,p=$(l),m=p,o=this.id;if(l.value==''){if(l.type=='password'){if(!p.data('placeholder-textinput')){try{q=p.clone().attr({type:'text'})}catch(n){q=$('').attr($.extend(g(this),{type:'text'}))}q.removeAttr('name').data({'placeholder-password':true,'placeholder-id':o}).bind('focus.placeholder',b);p.data({'placeholder-textinput':q,'placeholder-id':o}).before(q)}p=p.removeAttr('id').hide().prev().attr('id',o).show()}p.addClass('placeholder');p[0].value=p.attr('placeholder')}else{p.removeClass('placeholder')}}}(this,document,jQuery)); /** * Equal Heights Plugin * Equalize the heights of elements. Great for columns or any elements * that need to be the same size (floats, etc). * * Version 1.0 * Updated 12/10/2008 * * Copyright (c) 2008 Rob Glazebrook (cssnewbie.com) * * Usage: $(object).equalHeights([minHeight], [maxHeight]); * * Example 1: $(".cols").equalHeights(); Sets all columns to the same height. * Example 2: $(".cols").equalHeights(400); Sets all cols to at least 400px tall. * Example 3: $(".cols").equalHeights(100,300); Cols are at least 100 but no more * than 300 pixels tall. Elements with too much content will gain a scrollbar. * */ (function($) { $.fn.equalHeights = function(minHeight, maxHeight) { tallest = (minHeight) ? minHeight : 0; this.each(function() { if($(this).height() > tallest) { tallest = $(this).height(); } }); if((maxHeight) && tallest > maxHeight) tallest = maxHeight; return this.each(function() { $(this).height(tallest).css("overflow","visible"); }); } })(jQuery); /* * Taquiri Slider */ function tqslideinit() { jQuery(function ($) { if ($('.ie67').length < 1) { if ($('#tqslidewrapper').length > 0) { tqslideinterval = 7000; if($('#tqslides .tqslide').length > 1) { $('#tqslides').append($('.tqslide:first').clone().wrapAll('
').parent().html()); $('#tqslidewrapper').css('background','none'); anz = $('#tqslides').children().size(); $('#tqslides').children().each(function(no){ myid = 'slidernav' + (no + 1) + 'x'; if((no +1 ) < anz){ $('#slidernav').append('
  • ' + (no +1) + '
  • '); $('#' + myid).click(function(){ window.clearTimeout(tqslidertimer); ml = '-' + ( no * 100) + '%'; $('#tqslides').animate({ marginLeft: ml }, 1000,'linear'); setakt(no + 1); }); } }); var prevHTML = ''; var nextHTML = ''; if ($('#sliderprevnext').length > 0) { $('#sliderprevnext').html(prevHTML + nextHTML); } else { $('#slidernav') .prepend(prevHTML) .append(nextHTML) } setakt(1); $('.next').click(function() { window.clearTimeout(tqslidertimer); gonext(); }); $('.prev').click(function() { window.clearTimeout(tqslidertimer); goprev(); }); tqslidertimer = window.setTimeout(function() { gonext(tqslideinterval); }, tqslideinterval); }; }; } else { $('.figcaption:first').prependTo('#tqslide'); }; }); } /** * Zum nächsten gehen */ function gonext(interval){ jQuery(function ($) { interval = (typeof interval == 'undefined') ? 0 : interval; var timerfunction = ''; if (interval != 0) { var timerfunction = function() { tqslidertimer = window.setTimeout(function() { gonext(interval); }, interval); }; }; $('#tqslides').animate({ marginLeft: '-=100%' }, 1000,'linear',timerfunction); if((anz-1) <= akt){ $('#tqslides').animate({ marginLeft: '0%' }, 0,'linear'); akt = 0; } setakt( akt + 1); }); } /** * zum vorherigen gehen */ function goprev(){ jQuery(function ($) { if(akt==1){ ml = '-' + (anz - 1)*100 + '%'; $('#tqslides').animate({ marginLeft: ml }, 0,'linear'); akt = anz ; } $('#tqslides').animate({ marginLeft: '+=100%' }, 1000,'linear'); setakt ( akt - 1); }); } function setakt(nummer){ jQuery(function ($) { akt = nummer; myid = 'slidernav' + nummer + 'x'; $('#sliderprevnext').find('a').removeClass("active"); $('#' + myid + ' a').addClass("active"); }); } /* * tqTouchscreen - macht Dropdown-Menü auf Touchscreens zugänglich */ (function($){ $.fn.tqtouchscreen = function() { return this.each( function() { $(this).find('> li > ul').closest('li').children('a').each( function() { var item = $(this); item.click( function(event){ if (!item.hasClass('tapped')) { event.preventDefault(); item.addClass('tapped'); } else { window.location = item.attr('href'); } }).closest('li').mouseleave( function(){ item.removeClass('tapped'); }); }); }); }; })(jQuery); jQuery(document).ready(function($) { yepnope({ test : window.matchMedia, nope : $tq_wp_templateurl + '/js/yepnope/polyfill-matchmedia.js', complete : function() { yepnope({ load : [$tq_wp_templateurl + '/js/yepnope/enquire.js'], complete : function() { if (typeof enquire != 'undefined') { $('html').addClass('enquire'); if (!$('.ie678').length) { setupBreakpoints(); } } } }) } }); function setupBreakpoints() { enquire .register('screen and (max-width: 699px)', { match : function() { matchMax699() }, unmatch : function () { unmatchMax699() } }) .register('screen and (min-width: 700px) and (max-width: 959px)', { match : function() { matchMin700() }, unmatch : function () { unmatchMin700() } }) .register('screen and (min-width: 960px)', { match : function() { matchMin960() }, unmatch : function () { unmatchMin960() } }) .listen(); } function matchMax699() { $('html').addClass('breakpoint_0_matched'); setupMenuAsAcc($('#hauptmenu > ul'), true); accUpdate($('.acc'), 0); if ($('#tqslidewrapper').length > 0) { $('#hauptmenu').insertAfter('#tqslidewrapper').show(); } else { $('#header').removeClass('box-shadow'); $('#hauptmenu').prependTo('.main').show(); } } function unmatchMax699() { $('#header').addClass('box-shadow'); $('html').removeClass('breakpoint_0_matched'); $('#hauptmenu').appendTo('#header .maxwidth'); setupMenuAsAcc($('#hauptmenu > ul'), false); } function matchMin700() { $('html').addClass('breakpoint_700_matched'); $('#hauptmenu .home').addClass('hidden'); accUpdate($('.acc'), 700); } function unmatchMin700() { $('html').removeClass('breakpoint_700_matched'); } function matchMin960() { $('html').addClass('breakpoint_960_matched'); $('.equalheights').equalHeights(); accUpdate($('.acc'), 960); } function unmatchMin960() { $('html').removeClass('breakpoint_960_matched'); $('.equalheights').css('height', 'auto'); } function setupMenuAsAcc($el, $onOff) { $('#hauptmenu').hide(); switch ($onOff) { case true: $el.children('.menu-item').each(function(){ if (!$(this).hasClass('current-menu-ancestor')) { $(this).children('.sub').hide(); } }) $el.on('click.mobile', function(event){ event.preventDefault() event.stopPropagation(); $el = $(event.target); $sub = $el.parent().children('.sub'); if ($sub.length > 0) { $('.current_page_ancestor').removeClass('current_page_ancestor') if ($sub.is(':visible')) { $sub.slideUp(); } else { $('.sub:visible').slideUp(); $sub.slideToggle(); } $sub.closest('.menu-item').addClass('current_page_ancestor'); } else { window.location = $el.attr('href'); } }) break; case false: $el.off('click.mobile'); $el.find('.sub').show(); break; } $('#hauptmenu').show(); } tqslideinit(); /* * Wir rüsten alte Browser mit Placeholdern aus. Nett von uns! */ $('input, textarea').placeholder(); });