Showing SlideIn on Viewport Enter

Hello,

I am trying to set a piece of text to slide in from the left side of the screen when it enters the viewport. I’m not an experienced developer. Can anyone lend a rookie a hand?

Here’s what I had. I’m not saying the code makes perfect sense but is was the only combination I got that didn’t give me any errors…

export function SampleText2_viewportEnter($w) {
$w(“#SampleText2”).show(“SlideIn”);

Hi Michael,
I’m assuming that the text you want to show is hidden. If this is the case, it will never get to the viewport event, because it will never be viewed on the screen.
What you should do is to rely on a different object on the screen, and when that object will be viewed, then you can SildeIn the text.

Elad

I played around with it again untilI got code that wasn’t flagged as having errors, but it still didn’t work.
export function box2_viewportEnter($w) {
$w(“#SampleText2”).show(“SlideIn”);
}

Hey,
Does the box2 element hidden on load? Can you please send us the site URL so that we can have a look?

Thanks,
Tal.

Tal,
The box does not appear to be hidden on load. My site is not published yet, but I’d be happy to do whatever’s necessary to solve the problem.

I think I got it! The problem was that the text was marked as being hidden on load. When I unchecked the box, it was still “hidden”, but did the Slide In animation I wanted it to! Thanks for your help everyone!

2 Likes

how to hide a element in an anchor page?

I am making a single page website with the help of anchor page. I have added a static element which is common on all the anchor pages but I want to remove that element in few anchors pages. I tried using corvid but it removes that static element from all the pages.
I tried using a single line code " $w(“#myElement”).hide(); ", but it removes the static element from all the pages.
Please provide me with a solution as soon as possible so that I can continue designing my website.