fix block filter on scroll category
This commit is contained in:
parent
525a31b490
commit
32e7d65395
@ -1,8 +1,8 @@
|
||||
{if count($sizes) > 0}
|
||||
<div class="block_filter">
|
||||
<div class="content">
|
||||
<h4 class="open">{l s='Recherche par' mod='filtervp'} {$name} {l s='disponible' mod='filtervp'}</h4>
|
||||
|
||||
<h4 class="open">{l s='Recherche par' mod='filtervp'} {$name}</h4>
|
||||
|
||||
<div class="content_filter">
|
||||
<ul id="filters">
|
||||
{foreach from=$sizes item=size}
|
||||
@ -24,8 +24,18 @@
|
||||
$(document).ready(function() {
|
||||
$('.open').live('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
$('.block_filter .content').css({'position':'relative'});
|
||||
var new_top = $('#privatesales_categories_block_left').position().top;
|
||||
|
||||
$(this).toggleClass('active');
|
||||
$('.content_filter').toggle();
|
||||
if($(this).hasClass('active') == true) {
|
||||
new_top = $('#privatesales_categories_block_left').position().top + $('.block_filter .content_filter').height() + 25;
|
||||
} else {
|
||||
new_top = $('.block_filter').position().top + $('.block_filter').height();
|
||||
}
|
||||
$('#privatesales_categories_block_left').css({'top': new_top});
|
||||
});
|
||||
});
|
||||
{/literal}
|
||||
|
@ -70,7 +70,7 @@ $(document).ready(function() {
|
||||
fade: 0
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
if (($("#submenuw").length > 0)){
|
||||
var positionElementInPage = $('#submenuw').offset().top;
|
||||
$(window).scroll(
|
||||
@ -84,10 +84,10 @@ $(document).ready(function() {
|
||||
);
|
||||
}
|
||||
|
||||
$('#privatesales_categories_block_left li span.parent').parent().addClass('active');
|
||||
$('#privatesales_categories_block_left li span.parent').parent().addClass('active');
|
||||
$('#privatesales_categories_block_left li span.parent').live('click', function(e){
|
||||
e.preventDefault();
|
||||
if($(this).parent().hasClass('active')){
|
||||
if($(this).parent().hasClass('active')){
|
||||
$(this).parent().children('ul').hide();
|
||||
$(this).parent().removeClass('active');
|
||||
}else{
|
||||
@ -95,44 +95,74 @@ $(document).ready(function() {
|
||||
$(this).parent().children('ul').show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
if($('#privatesales_categories_block_left').length > 0){
|
||||
var elem = $('#privatesales_categories_block_left');
|
||||
var position_elem = $(elem).position();
|
||||
var initial_position = position_elem.top;
|
||||
|
||||
if($('.block_filter').length > 0){
|
||||
elem = $('.block_filter');
|
||||
var position_elt_filter = $(elem).position();
|
||||
initial_position = position_elt_filter.top;
|
||||
|
||||
var elem_content = $('.block_filter .content');
|
||||
var elem_2 = $('#privatesales_categories_block_left');
|
||||
}
|
||||
|
||||
$(window).scroll(function(){
|
||||
var scroll = $(window).scrollTop();
|
||||
var marginApply = scroll + 10;
|
||||
|
||||
|
||||
if(parseInt(scroll) >= parseInt(initial_position) ){
|
||||
var position_menu_bas = $(elem).position().top + $(elem).height() + 10;
|
||||
var position_menu_bas = $(elem).position().top + $(elem).height() + 10;
|
||||
var position_center_bas = $('.main_category_vp').position().top + $('.main_category_vp').height() - 20;
|
||||
|
||||
var top_max = scroll + $(elem).height();
|
||||
|
||||
if($('.block_filter').length > 0){
|
||||
var top_elem_2 = position_center_bas - $(elem).height();
|
||||
var top_elem_2_margin = marginApply + $(elem).height();
|
||||
}
|
||||
|
||||
if(top_max > position_center_bas){
|
||||
elem.css({'position': 'absolute' });
|
||||
elem.css({'top': position_center_bas - $(elem).height() });
|
||||
elem.css({'position': 'absolute'});
|
||||
elem.css({'top': position_center_bas - $(elem).height() });
|
||||
if($('.block_filter').length > 0){
|
||||
elem_2.css({'position': 'absolute' });
|
||||
elem_2.css({'top': top_elem_2 });
|
||||
|
||||
elem.css({'width': $(elem_2).width() });
|
||||
}
|
||||
}else{
|
||||
elem.css({'position': 'absolute' });
|
||||
elem.css({'top': marginApply });
|
||||
if($('.block_filter').length > 0){
|
||||
elem_2.css({'position': 'absolute' });
|
||||
elem_2.css({'top': top_elem_2_margin });
|
||||
|
||||
elem.css({'width': $(elem_2).width() });
|
||||
}
|
||||
}
|
||||
}else{
|
||||
elem.css({'position': 'inherit' });
|
||||
elem.css({'top': 'auto' });
|
||||
if($('.block_filter').length > 0){
|
||||
elem_2.css({'position': 'inherit' });
|
||||
elem_2.css({'top': 'auto' });
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(window).load(function() {
|
||||
$('.flexslider').flexslider({
|
||||
animation: "slide",
|
||||
controlNav: false,
|
||||
slideshow: false,
|
||||
itemWidth: 300,
|
||||
itemWidth: 300,
|
||||
pauseOnHover : false,
|
||||
mousewheel: false,
|
||||
});
|
||||
@ -144,14 +174,14 @@ $(document).ready(function() {
|
||||
|
||||
|
||||
<div id="left_column" class="column left_vp">
|
||||
{$HOOK_LEFT_COLUMN_VP}
|
||||
{$HOOK_LEFT_COLUMN_VP}
|
||||
</div>
|
||||
|
||||
{if isset($category)}
|
||||
{if $category->id AND $category->active}
|
||||
|
||||
<div class="main_category_vp">
|
||||
<div class="catHeadW">
|
||||
<div class="catHeadW">
|
||||
<div class="catHeadDescW">
|
||||
{if $sale}
|
||||
<div class="psales">
|
||||
|
Loading…
Reference in New Issue
Block a user