[[!AjaxForm?
&snippet=`FormIt`
&form=`tpl-only-form`
&hooks=`email,order_to_amo`
&emailSubject=`тема`
&emailTpl=`EmailTpl-only-form`
&emailTo=`myemail@mail.ru`
&emailFrom=`[[$email_from]]`
&ClientName=`name`
&ClientPhone=`phone`
&ClientEmail=`email`
&ClientAddress=`address`
&validate=`phone:required`
&validationErrorMessage=`В форме содержатся ошибки!`
&successMessage=`Спасибо за оставленную заявку. <br />Наши менеджеры свяжутся с Вами`
]]
<li class="cd-item" id="prdct1">
<img src="img/product/6_5-d/9.jpg" alt="Item Preview">
<a href="#prdct" class="cd-trigger">Посмотреть</a>
<div class="quick-view-content">
<div class="quick-view-content-wrapper">
<div class="cd-slider-wrapper">
<ul class="cd-slider">
<li class="selected"><img src="img/product/6_5-d/9.jpg"></li>
<li><img src="img/product/6_5-d/1.jpg"></li>
<li><img src="img/product/6_5-d/2.jpg"></li>
<li><img src="img/product/6_5-d/3.jpg"></li>
<li><img src="img/product/6_5-d/4.jpg"></li>
<li><img src="img/product/6_5-d/5.jpg"></li>
<li><img src="img/product/6_5-d/6.jpg"></li>
<li><img src="img/product/6_5-d/7.jpg"></li>
<li><img src="img/product/6_5-d/8.jpg"></li>
</ul>
<ul class="cd-slider-navigation">
<li><a class="cd-next" href="#">Prev</a></li>
<li><a class="cd-prev" href="#">Next</a></li>
</ul> <!-- cd-slider-navigation -->
</div> <!-- cd-slider-wrapper -->
<div class="cd-item-info">
<h2>Smart Balance 6,5 дюймов</h2>
<span class="price">11990 </span><span class="glyphicon glyphicon-ruble price-span" aria-hidden="true"></span>
<span class="price-to">16 990 </span><span class="glyphicon glyphicon-ruble price-to-span" aria-hidden="true"></span>
<p>Эта модель как Porsche 911 среди автомобилей.<br />Быстро срывается с места. Резко входит в повороты. Весит всего 10 кг. Любит гладкие и ровные поверхности. Крепкий корпус. Езда на нем будет с ветерком, но будет чувствоваться каждый камушек.</p>
<form method="POST" class="mail-to" action="mail.php">
<input type="text" name="phone" required placeholder="Телефон">
<input class="my-btn yellow-my-btn" type="submit" value="Отправить">
</form>
</div> <!-- cd-item-info -->
</div>
</div>
</li> <!-- cd-item -->
jQuery(document).ready(function($){
//final width --> this is the quick view image slider width
//maxQuickWidth --> this is the max-width of the quick-view panel
var sliderFinalWidth = 400,
maxQuickWidth = 900;
//open the quick view panel
$('.cd-trigger').on('click', function(event){
var selectedImage = $(this).parent('.cd-item').children('img'),
selectedproduct = $(this).parent('.cd-item'),
qvcontent = selectedproduct.children('.quick-view-content').html(),
qvwarpper = document.getElementById('cd-quick-view');
qvoveraly = document.getElementById('cd-quick-view-coverlay');
slectedImageUrl = selectedImage.attr('src');
$('body').addClass('overlay-layer');
$(qvoveraly).addClass('overlay_active');
animateQuickView(selectedImage, sliderFinalWidth, maxQuickWidth, 'open');
//update the visible slider image in the quick view panel
//you don't need to implement/use the updateQuickView if retrieving the quick view data with ajax
updateQuickView(slectedImageUrl);
$('#cd-quick-view').children('.quick-view-content-wrapper').remove();
$(qvwarpper).append(qvcontent);
// $('body, html').css({
// 'overflow':'hidden',
// 'height':'100%'
// });
});
//close the quick view panel
$(document).on('click','.cd-close', function(event){
closeQuickView( sliderFinalWidth, maxQuickWidth);
$(qvoveraly).removeClass('overlay_active');
// $('body, html').css({
// 'overflow':'auto',
// 'height':'auto'
// });
});
$('#cd-quick-view-coverlay').click(function(event){
closeQuickView( sliderFinalWidth, maxQuickWidth);
$(qvoveraly).removeClass('overlay_active');
$('body, html').css({
'overflow':'auto',
'height':'auto'
});
});
$(document).keyup(function(event){
//check if user has pressed 'Esc'
if(event.which=='27'){
closeQuickView( sliderFinalWidth, maxQuickWidth);
}
});
//quick view slider implementation
$('.cd-quick-view').on('click', '.cd-slider-navigation a', function(){
updateSlider($(this));
});
//center quick-view on window resize
$(window).on('resize', function(){
if($('.cd-quick-view').hasClass('is-visible')){
window.requestAnimationFrame(resizeQuickView);
}
});
function updateSlider(navigation) {
var sliderConatiner = navigation.parents('.cd-slider-wrapper').find('.cd-slider'),
activeSlider = sliderConatiner.children('.selected').removeClass('selected');
if ( navigation.hasClass('cd-next') ) {
( !activeSlider.is(':last-child') ) ? activeSlider.next().addClass('selected') : sliderConatiner.children('li').eq(0).addClass('selected');
} else {
( !activeSlider.is(':first-child') ) ? activeSlider.prev().addClass('selected') : sliderConatiner.children('li').last().addClass('selected');
}
}
function updateQuickView(url) {
$('.cd-quick-view .cd-slider li').removeClass('selected').find('img[src="'+ url +'"]').parent('li').addClass('selected');
}
function resizeQuickView() {
var quickViewLeft = ($(window).width() - $('.cd-quick-view').width())/2,
quickViewTop = ($(window).height() - $('.cd-quick-view').height())/2;
$('.cd-quick-view').css({
"top": quickViewTop,
"left": quickViewLeft,
});
}
function closeQuickView(finalWidth, maxQuickWidth) {
var close = $('.cd-close'),
activeSliderUrl = close.siblings('.cd-slider-wrapper').find('.selected img').attr('src'),
selectedImage = $('.empty-box').find('img');
//update the image in the gallery
if( !$('.cd-quick-view').hasClass('velocity-animating') && $('.cd-quick-view').hasClass('add-content')) {
selectedImage.attr('src', activeSliderUrl);
animateQuickView(selectedImage, finalWidth, maxQuickWidth, 'close');
} else {
closeNoAnimation(selectedImage, finalWidth, maxQuickWidth);
}
}
function animateQuickView(image, finalWidth, maxQuickWidth, animationType) {
//store some image data (width, top position, ...)
//store window data to calculate quick view panel position
var parentListItem = image.parent('.cd-item'),
topSelected = image.offset().top - $(window).scrollTop(),
leftSelected = image.offset().left,
widthSelected = image.width(),
heightSelected = image.height(),
windowWidth = $(window).width(),
windowHeight = $(window).height(),
finalLeft = (windowWidth - finalWidth)/2,
finalHeight = finalWidth * heightSelected/widthSelected,
finalTop = (windowHeight - finalHeight)/2,
quickViewWidth = ( windowWidth * .8 < maxQuickWidth ) ? windowWidth * .8 : maxQuickWidth ,
quickViewLeft = (windowWidth - quickViewWidth)/2;
if( animationType == 'open') {
//hide the image in the gallery
parentListItem.addClass('empty-box');
//place the quick view over the image gallery and give it the dimension of the gallery image
$('.cd-quick-view').css({
"top": topSelected,
"left": leftSelected,
"width": widthSelected,
}).velocity({
//animate the quick view: animate its width and center it in the viewport
//during this animation, only the slider image is visible
'top': finalTop+ 'px',
'left': finalLeft+'px',
'width': finalWidth+'px',
}, 1000, [ 400, 20 ], function(){
//animate the quick view: animate its width to the final value
$('.cd-quick-view').addClass('animate-width').velocity({
'left': quickViewLeft+'px',
'width': quickViewWidth+'px',
}, 300, 'ease' ,function(){
//show quick view content
$('.cd-quick-view').addClass('add-content');
});
}).addClass('is-visible');
} else {
//close the quick view reverting the animation
$('.cd-quick-view').removeClass('add-content').velocity({
'top': finalTop+ 'px',
'left': finalLeft+'px',
'width': finalWidth+'px',
}, 300, 'ease', function(){
$('body').removeClass('overlay-layer');
$('.cd-quick-view').removeClass('animate-width').velocity({
"top": topSelected,
"left": leftSelected,
"width": widthSelected,
}, 500, 'ease', function(){
$('.cd-quick-view').removeClass('is-visible');
parentListItem.removeClass('empty-box');
});
});
}
}
function closeNoAnimation(image, finalWidth, maxQuickWidth) {
var parentListItem = image.parent('.cd-item'),
topSelected = image.offset().top - $(window).scrollTop(),
leftSelected = image.offset().left,
widthSelected = image.width();
//close the quick view reverting the animation
$('body').removeClass('overlay-layer');
parentListItem.removeClass('empty-box');
$('.cd-quick-view').velocity("stop").removeClass('add-content animate-width is-visible').css({
"top": topSelected,
"left": leftSelected,
"width": widthSelected,
});
}
/* Stop page jumping when links are pressed */
$('a[href="#"]').live("click", function(e) {
return false; // prevent default click action from happening!
e.preventDefault(); // same thing as above
});
});