Tagged: x
-
AuthorPosts
-
April 25, 2016 at 8:59 am #898631
Laurie HParticipantHi again!
Sorry, another question please…
My page content scrolls up with the page. The 2 columns on the left I wish to scroll up continuously, but the column on the right which contains an accordion, I wish to scroll up with the rest of page content, but I would like it to stop scrolling and remain fixed when it reaches the top of the page.At the moment i have this in the custom JS:
jQuery(function($){
$(window).scroll(function(){
if( $(this).scrollTop() >= $(‘.x-main’).offset().top ) {
$(‘.x-accordion’).addClass(‘fix-accordion-position’);
}
else {
$(‘.x-accordion’).removeClass(‘fix-accordion-position’);
}
})
});And in the custom CSS I have this:
.fix-accordion-position {
position: fixed !important;
top: 120px !important;
width: 300px !important;
}I have added a class of .fix-accordion-position to the accordion element in Cornerstone.
The accordion starts scrolling with the rest of the page, but then it jumps to the top. And it jumps around on page reload too.
Can you advise please? I can send my login details again if you need themThanks again!:)
April 25, 2016 at 7:18 pm #899501
JadeModeratorHi there,
Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
April 26, 2016 at 3:03 am #899880
Laurie HParticipantThis reply has been marked as private.April 26, 2016 at 7:14 pm #901213
NicoModeratorHi There,
Little bit confuse of what you are trying to achieve.
Would you mind sharing us more details of what you are trying get.
You can remove the code below to remain fix after scrolling.
$('.x-accordion').removeClass('fix-accordion-position');Hope it helps.
Thanks.
April 27, 2016 at 4:29 am #901744
Laurie HParticipantHello Nico
So, if you can please go to the Work Page on the site. The starting position is like the screenshot I have attached (with the 2 images on the left, and the accordion on the right, all aligned level.) Then if you scroll the page up in your browser window, all the page elements scroll up smoothly, except the blue accordion on the right side, which scrolls smoothly to start with, then it jumps into fixed position at the top of the page.
What I want to achieve is that the blue accordion scrolls smoothly up and down the page (with the other elements), as the user scrolls his browser window. But it should never go off the page at the top, hence it needs to scroll smoothly then remain in fixed position at the top (so it is always visible).
At the moment the blue accordion is not working correctly, because it jumps up the page to the top, and it jumps back down the page too.
I hope you can help with something wrong in my javascript?
Many Thanks 🙂April 27, 2016 at 3:35 pm #903000
RadModeratorHi there,
Please change this line of code
if( $(this).scrollTop() >= $('.x-main').offset().top ) {to this one
if( $(this).scrollTop() >= $('.page-id-868 #x-section-2').offset().top ) {Hope this helps.
April 28, 2016 at 3:36 am #903704
Laurie HParticipantHi Rad,
I have changed that line and it works perfectly 🙂 Thank you so much, great support!
April 28, 2016 at 1:20 pm #904487
Prasant RaiModeratorHappy to hear that. Feel free to ask us again. Have a great day! 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-898631 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
