Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

Zahurul

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by Zahurul

  1. 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... ๐Ÿ‘
  2. I am trying to get effect like this pen, only differencen, once ".sun" element touch/enter ".landscape" element it should sroll with ".landscape" element normally. What is the best way to do so? I can do it if one element inside another, but here i need to trigger based on multiple element. Please help, Thanks. https://codepen.io/aboutzahurul/pen/ExyMZOw
  3. 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.
  4. 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...๐Ÿ˜‚
  5. Thank you guys @akapowl @kasim444. will implement this in my future project, without complexity ๐Ÿ˜€ Greensock rocks ๐Ÿ‘, it makes complex task easier...
  6. 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 devide (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.
  7. 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
  8. 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...
  9. 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 beacuse 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
  10. 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: <div id="content"> <div class="item"> <div class="img-box"><img src="https://via.placeholder.com/300x300?text=001" /></div> <h2><span>title1</span></h2> </div> <div class="item"> <div class="img-box"><img src="https://via.placeholder.com/300x300?text=002" /></div> <h2><span>title2</span></h2> </div> <div class="item"> <div class="img-box"><img src="https://via.placeholder.com/300x300?text=003" /></div> <h2><span>title3</span></h2> </div> </div> after jQuery("#content").load("/somePageURL #content"); call newly replaced HTML (#content) may be like this: <div id="content"> <div class="item"> <h2><span>title1</span></h2> </div> <div class="item"> <div class="img-box"><img src="https://via.placeholder.com/300x300?text=002" /></div> </div> <div class="item"> <div class="img-box"><img src="https://via.placeholder.com/300x300?text=003" /></div> <h2><span>title3</span></h2> </div> <div class="item"> <div class="img-box"><img src="https://via.placeholder.com/300x300?text=004" /></div> <h2><span>title4</span></h2> </div> <div class="item"> <div class="img-box"><img src="https://via.placeholder.com/300x300?text=005" /></div> </div> <div class="item"> <div class="img-box"><img src="https://via.placeholder.com/300x300?text=006" /></div> <h2><span>title6</span></h2> </div> </div> So now, how can i reload the scroll triggered animation correctly without reloading the page? Please help... Thanks.
ร—