en en en en en en en en en en en en en en en en fa en en fr hbs_lat en en en es en en en ms en de en fr en en en ca en en en en en en en ro ro en en en en en en en en en en en en fa en en en en en en fi hbs_lat en en en en en en en en en de es en en en en en en en en en en de nb en en de si ms en en en en en en de nb en en de si ms en en en en en en de nb en en de si ms en en en en en en de si nb en de si fi en en en en en en en en en en en en en en en en de si nb en de si fi en en en en en de si nb en de si fi en en en en en de si nb en de si fi en en en en en de si nb en de si fi en en ro en en en en en en en de en de en es en en en en en fr en en en en en en en fr cv es tr es en en en en ms en en en en en en fr en hbs_lat en en en en en en en fr cv es tr es en en en en de en en en ca en en en en en
I was preparing to do it by scrollmagic cos before i have done something like this for website sidebar, but mainly i wanted to do it in GSAP 3 cos i already used it for other animation and scroll related function but for this issue couldn't find a simple solution. Thanks a lot @mikel for your very simplified solution, will implement it on my upcoming website very soon. Greensock rocks... 👍
Pin absolute element as fixed for entire page scroll until it reach certain element
Zahurul replied to Zahurul's topic in GSAP
Zahurul posted a topic in GSAP
Hi, I am trying to pin ".sun" element on bottom right of the page as fixed from start of the page till it reach the ".landscape" element, when ".sun" enter the ".landscape" element then it should scroll as normal with page. I am trying to achieve it by gsap 3 with scroll trigger plugin easiest and efficient way. on my codepen it doing totally opposite what i am trying to achieve. can anybody help please.
One interesting stuff learned today, if i need the trigger animation once, then setting "once: true" will do the job, no need killing or refresh, even from performance point its much efficient. good tips to know, i didn't know that...😂
Fixing to the bottom during scrolling after fading effect
Zahurul replied to kasim444's topic in GSAP
Thank you guys @akapowl @kasim444. will implement this in my future project, without complexity 😀 Greensock rocks 👍, it makes complex task easier...
Fixing to the bottom during scrolling after fading effect
Zahurul replied to kasim444's topic in GSAP
Hi, i am not that expart on it but i think the logic maybe: get the viewport/scroll-container/section clientHeight then get the desire height where you want to show/pin/animate the download button by divide (clientHeight - viewport height) by 2 for half height then put your logic on ScrollTrigger onUpdate property (https://greensock.com/docs/v3/Plugins/ScrollTrigger) based on calculated height vs onUpdate progress onUpdate: ({progress, direction, isActive}) => console.log(progress, direction, isActive) then do the animation as needed on timeline. Hope it may give you some idea to think about. sorry if i am wrong.... 😂 Thanks.
GSAP/ScrollTigger reload on DOM change/update/replaced by ajax call
Zahurul replied to Zahurul's topic in GSAP
Hi, @akapowl it seems your solution working here, thanks for your solution 👍... on other hand on ajax page load killing scroll and handling timer bit more work to do 😅... Ater reading some more documantation i found that, adding ScrollTrigger.refresh(true); on main timeline function revealItemsOnScroll(); resolved the issue simply. so main function changed to: function revealItemsOnScroll(){ if ( jQuery("#content .item").length ) { var revealItems = gsap.utils.toArray('#content .item'); revealItems.forEach( function(revealItem, index){ var singleImage = revealItem.querySelector("div > img"); var singleTitle = revealItem.querySelector("h2 > span"); var pageElement = gsap.timeline(); ScrollTrigger.refresh(true); if( typeof(singleImage) != 'undefined' && singleImage != null ){ pageElement.to( singleImage, { scrollTrigger: { trigger: singleImage, end: 'bottom top', start: 'top bottom', markers: true onEnter: () => { singleImage.classList.add("active"); }, onLeaveBack: () => { singleImage.classList.remove("active"); }, } }); } if( typeof(singleTitle) != 'undefined' && singleTitle != null ){ pageElement.to( singleTitle, { scrollTrigger: { trigger: singleTitle, end: 'bottom top', start: 'top 90%', markers: {startColor: "blue", endColor: "lime"}, onEnter: () => { singleTitle.classList.add("active"); }, onLeaveBack: () => { singleTitle.classList.remove("active"); } } }); } }); } } I have also updated the codepane and it seems now working: https://codepen.io/aboutzahurul/pen/OJXaamP on my live code its also working fine, will check if there any more issue or not... now my next goal to add smooth scroll into it, i am trying to follow this codepen: https://codepen.io/osublake/pen/89f1e24fbc30e59edbc186a4c961f35c let me know if you guys have any suggession.... Thanks you guys, very happy to see your quick respons 👍 Cheers, Zahurul
GSAP/ScrollTigger reload on DOM change/update/replaced by ajax call
Zahurul replied to Zahurul's topic in GSAP
sorry... yes page load handelled by jquery... I tried kill but no luck yet, still trying to resolve... I just updated the codepen a bit so it switch content, you can see on content element change it seems working but if you see the markers and content height etc it still a bit mess, can anybuddy suggest? https://codepen.io/aboutzahurul/pen/OJXaamP Thanks...
GSAP/ScrollTigger reload on DOM change/update/replaced by ajax call
Zahurul replied to Zahurul's topic in GSAP
thanks @76748-akapowl for your replay and for you suggestion, will try it... i tried to recreate the issue differently in codepen by replace html but seems like working: https://codepen.io/aboutzahurul/pen/OJXaamP but on my real code not working 🤔.... is it because i load them by jquery(). load()? my actual load content code like below: jQuery("#main-content").load( link + ' #main-content section', function( responseText, textStatus, jqXHR ){ if( textStatus == 'success'){ var pageTitle = jQuery(responseText).filter('title').text(); //Letting browser to know new page loaded and added to browser history window.history.pushState( null, pageTitle, link ); //setting browser title if current browsers don't support pushState title attribute document.title = pageTitle; //scrolling to top window.scrollTo(0,0); console.log( link, textStatus + ' (' + jqXHR.status + ')' ); //Trigger custom events jQuery(document).trigger('page.loaded',[link]); } if( textStatus == 'error'){ console.log( textStatus + ': ' + jqXHR.status + ' loading failed' ); } }); jQuery( window ).on("load page.loaded", function(e) { revealItemsOnScroll(); }); Is there something i am doing wrong? Thanks
GSAP/ScrollTigger reload on DOM change/update/replaced by ajax call
Zahurul posted a topic in GSAP
Hi, I am new to GSAP and trying to reload GSAP/ScrollTigger on DOM #content element change, which can done by many ways, my case: jQuery("#content").load("/somePageURL #content") then the new content replace current page DOM content, and at this stage my code dont work. On my code pen example https://codepen.io/aboutzahurul/pen/bGeQKvy everything works fine on page load (not sure if its the correct way or not) but as if i change #content by calling jQuery("#content").load("/somePageURL #content"); and i replace current content and add custom jquery trigger jQuery(document).trigger('page.loaded',[link]); so i can reload the main timeline function based on the custom trigger page.Loaded but it never load correctly and GSAP animation breaks, only it work if i reload the page on browser. sorry on my Codepen example i didn't added the ajax function to jQuery("#content").load(); cos i am not very expart on codepen but i hope you guys got the idea. On my newly replaced #content may have more .item element or less or empty so i tried to do some checks before i call GSAP timeline. Current HTML:           title1             title2             title3       after jQuery("#content").load("/somePageURL #content"); call newly replaced HTML (#content) may be like this:       title1                     title3             title4                     title6       So now, how can i reload the scroll triggered animation correctly without reloading the page? Please help... Thanks.
“Every time a new GSAP plugin is introduced, I'm close to bursting from excitement. The simplicity of the GreenSock API makes learning and applying these tools in projects such a dream.”
“The depth of GSAP blows me away like all the time. It seems like I stumble on something new and amazing every time I peek at the docs.”
“@greensock is just pure awesomeness. What more can be said?”
“I can definitely say ever since I started using GSAP, my work exponentially improved. It basically changed my life.”
“This stuff is so incredibly amazing I can't believe it. The level of details and options put into these things and the natural instinct GreenSock has for solving everyday problems is impressive.”
“I’ve long felt like GSAP is the best kept secret in JavaScript.”
“I absolutely love working with GSAP. It’s been one of the most enjoyable things I’ve ever studied and the team do a fantastic job of making it first of all but also in the fantastic forums. I’ve managed to learn so much from that so I’ll always be gratefu”
“Without GSAP I would have ditched front-end dev the day Flash officially died.”
“Truly, you folks on this forum are the nicest, least judgmental, helpful people I've ever encountered.”
Sign Up For Our Newsletter
Get the latest updates on GreenSock products, exclusive offers, and more right in your inbox.
Your information will always be kept confidential.
Thanks for signing up!
Now you'll begin receiving the latest GreenSock updates, exclusive offers, and more right in your inbox. Welcome aboard.