1
I have the following code:
JAVASCRIPT
//fix lateral filter and gallery on scrolling
$('.cd-filter-trigger').click(function () {
(!window.requestAnimationFrame) ? fixGallery() : window.requestAnimationFrame(fixGallery);
});
function fixGallery() {
var offsetTop = $('.cd-main-content').offset().top,
scrollTop = $(window).scrollTop();
( scrollTop >= offsetTop ) ? $('.cd-main-content').addClass('is-fixed') : $('.cd-main-content').removeClass('is-fixed');
}
This code performs the fixing of a bar on the side (a filter), however, after the user clicks and the bar is fixed, it should continue to fix only in the area ('.cd-main-content'), however, it is fixed on the whole side of the page.... How can I fix this?
Hello Hitch, can you post HTML and CSS and if possible simulate the problem in Stackoverflow Code Snippet (preferably) or Jsfiddle? So you help us help you... :)
– KaduAmaral
Kadu... The code is: http://codyhouse.co/demo/content-filter/index.html, I need to resolve the above problem in this code...
– Hitch Leonardo
Ali is the code of framework, right? Isn’t that the problem? Do so, open the browser Developer Tools and check if the element with the class
.cd-main-content
is withposition: relative
, because from what I saw the.cd-filter
usesposition: absolute
, then he’ll take the referencetop: 0
andleft: 0
of the next of kinposition: relative
, if no relative has this property he will refer tobody
.– KaduAmaral
Hitch, use the edit button of your question, to add/change information, do not duplicate questions.
– KaduAmaral