jQuery.noConflict(); holidayplannerAjaxConfiguration = { //baseurl : jQuery('head base').attr('href'), baseurl : '', type : '&type=89657201' }; jQuery(document).ready(function(){ jQuery('ul#holidayCards li').css('cursor', 'pointer'); CardlinkHover(); /** * Modify URL or ACTION for Ajax call */ jQuery('.tx_holidayplanner_criterias form').attr('action', function(i,url) { return holidayplannerAjaxConfiguration.baseurl + jQuery(this).attr('action').replace(/list/g, 'holydayCards') + holidayplannerAjaxConfiguration.type; }); modifyCardLinks(); //googleLinkAjaxFunction(); this function will be called in Resources/Private/Templates/Offer/Singel.html cardLinkAjaxFunction(); /** * LOAD content per AJAX / AjaxForm */ var options = { target: '.planerHints', // target element(s) to be updated with server response beforeSubmit: showRequest, // pre-submit callback success: showResponse() // post-submit callback //complete: modifyCardLinks() // other available options: //url: url // override for form's 'action' attribute //type: type // 'get' or 'post', override for form's 'method' attribute //dataType: null // 'xml', 'script', or 'json' (expected server response type) //clearForm: true // clear all form fields after successful submit //resetForm: true // reset the form after successful submit // $.ajax options can be used here too, for example: //timeout: 3000 }; // bind form using 'ajaxForm' jQuery('.tx_holidayplanner_criterias form').ajaxForm(options); }); // pre-submit callback function showRequest(formData, jqForm, options) { // formData is an array; here we use $.param to convert it to a string to display it // but the form plugin does this for you automatically when it submits the data var queryString = $.param(formData); // jqForm is a jQuery object encapsulating the form element. To access the // DOM element for the form do this: // var formElement = jqForm[0]; var request = { queryString: queryString } //console.log(request); // here we could return false to prevent the form from being submitted; // returning anything other than false will allow the form submit to continue return true; } // post-submit callback function showResponse(responseText, statusText, xhr, $form) { // for normal html responses, the first argument to the success callback // is the XMLHttpRequest object's responseText property // if the ajaxForm method was passed an Options Object with the dataType // property set to 'xml' then the first argument to the success callback // is the XMLHttpRequest object's responseXML property // if the ajaxForm method was passed an Options Object with the dataType // property set to 'json' then the first argument to the success callback // is the json data object returned by the server var response = { status: statusText, responseText: responseText, } //console.log(response); } /** * modifyCardLinks To load per Ajax and different Page Type */ function modifyCardLinks() { jQuery('ul#holidayCards').find('li').each(function(){ jQuery(this).find('a.offer_detail_ajax').attr('href', function(){ return holidayplannerAjaxConfiguration.baseurl + jQuery(this).attr('href') + holidayplannerAjaxConfiguration.type; }); }); } function cardLinkAjaxFunction() { /** * TODO: OPEN WIDTH LIGHT BOX */ jQuery('ul#holidayCards li').click(function(){ url = jQuery(this).find('.offer_detail_ajax').attr('href'); colorboxOptions = { href: url, innerWidth: '800px', initialWidth: '600px', initialHeight: '600px', innerHeight: '80%', opacity: 0.7, onComplete: function(){ googleLinkAjaxFunction(colorboxOptions); } } jQuery.colorbox(colorboxOptions); return false; }); } /** * googleLinkAjaxFunction * this function will be called in Resources/Private/Templates/Offer/Singel.html */ function googleLinkAjaxFunction(colorboxOptions) { jQuery('.googleMaps a').click(function(){ alpsteinUrl = jQuery('.googleMaps a').attr('href'); jQuery.fn.colorbox({ href: alpsteinUrl, iframe: true, width: '800px', height: '500px', scrolling: true, opacity: 0.7, onClosed: function(){ jQuery.colorbox(colorboxOptions); } }); return false; }); } function CardlinkHover() { // Tipps bei hover vergrößern jQuery('#holidayCards li').hover( function () { $(this).css({'width' : '150px', 'z-index' : '2'}); $(this).find('.image').css({'width' : '150px', 'height' : '150px'}); $(this).find('.image img').css({'height' : '150px'}); }, function () { $(this).css({'width' : '105px', 'z-index' : '1'}); $(this).find('.image').css({'width' : '105px', 'height' : '105px'}); $(this).find('.image img').css({'height' : '105px'}); } ); }