Vue3 + element-plus side menu: overlay in mobile and animation issue - vuejs3

Vue 3 and UI newbie here. Given this playground area with a code sample, I wanted
In the "collapse" animation of the menu, for the entire menu to slide out (but if you notice, the size of the menu changes first - making it occupy less than 100% of the height - and then it slides out)
If it is a smaller screen, I wanted the side menu to be collapsed by default and for it to be an overlay when sliding in (so the main contents are not pushed by it when sliding in)
As a Vue and UI beginner, I feel like I am going down the wrong paths when trying to explore solutions for these problems, and was hoping the community of experienced developers could help me with them.

I ended up using https://github.com/amirkian007/vue-awesome-sidebar. It is a pretty neat component.

Related

Creating a parallax affect with react-scroll-parallax and image masks

Here is the desired outcome I'm looking to achieve by scrolling using react-scroll-parallax.
On Mobile browser
View web browser example here
Description
I want to create a website with the parallax affect shown above. The key elements being a website build in react containing three pages.
While scrolling from Page 1 to Page 2 I want the mobile device mock to start halfway on the screen (as to avoid the other content of page 1), then move to being basically centered.
While scrolling from Page 2 to Page 3, the website and components stick and once again act like a normal website scroll.
Additionally, during the scroll from Page 1 to Page 2, I want the content inside the device mock to scroll as well.
What I tried
For starters I was able to get nearly the affect I wanted by using a div with it's z-index and absolute position set, and parallax on translateY of -50, 125.
<div className={"absolute z-10 w-full"}>
<Parallax translateY={[-50, 125]}></Parallax>
</div>
The problem became however when I wanted to place content inside the div. Having another div within the parallax that also had z-index set seemed to mess with the parallax affect.
Important notes
Content inside device mock
One issue I found that was tricky was trying to place the content inside the device mock. I want a parallax both on the device mock itself, and the content within it.
I'm not entirely sure how I should crop the content inside the device mock.
The device mock svg frame and device mock mask can be found here if you want to give it a try
Device mock svg and mask
I tried imgs with various z-indexes, masking the div with an svg mask, using image backgrounds. Nothing is quite getting the preferred outcome.
Scaling of device mock
I want to make sure this works well on both mobile and browser. With that said I was trying to use margins to scale the device mock but I had a hard time with trying to then correctly get the mask to work for the content within the mock.
I'm not sure if using dedicated width and height sizes would be the ideal way to go, but very open to suggestions! It seems hard to scale the device frame and the mask properly.
Parallax of device and parallax of device content
I want the content inside the device mock to be html so that I can change it more than just an image. That being said the most important feature I want is for both the device and the content inside to have a parallax scroll affect.
Summary
I know this is a bit much for a quick simple stack overflow issue, but I've been trying a lot to get this to work and just can't seem to nail down the little details correctly. I sincerely appreciate all help and suggestions and if there is anything else I can provide please let me know!
The trickier part of the request was blowing up the <svg>, adding new <path /> and <clipPath /> for the color swap inside the phone mock.
Eventually I got it working here. The part linking the clipPath transition to the scroll progress looks like this:
const [y, setY] = React.useState(1739);
const onProgressChange = React.useCallback(
(a) =>
setY(Math.max(Math.min(1739, 1739 - ((a - 0.24) / 0.0018) * 17), 36)),
[setY]
);
const { ref } = useParallax({
translateY: [0, 185],
onProgressChange
});
The 1739 and 36 are max and min values for the translation and they are strictly related to the svg's viewBox. The other values allow tweaking the start, end and speed of animation, with regards to overall scroll progress.
This, together with some CSS, took care of binding the right animations to the correct scroll progress.
Feel free to tweak it some more, especially if you add more markup.
The other thing I wanted was a function activated shortly after scrolling, which would snap the scroll to certain positions. Namely, to the .page elements.
I used gsap's ScrollTrigger plugin for the task, for multiple reasons:
I'm somewhat familiar with it (used it before)
it's performant, light and non-obtrusive (basically quits when it detects another user scroll)
listens to all relevant events (touch, mouse pointer, keyboard) without me having to make sense of them, providing a unified interface.
uses inertia (if you scroll down faster from page 1 it will scroll past page 2, directly to page 3 - other scroll plugins limit you to having to scroll once for each page change)
works well on mobile devices
There are other libs/plugins out there for the task, you don't have to use gsap (although I do think it's awesome). If you end up including it in your project, make sure you comply with their licensing (which is not MIT).
By the way, my first choice for the parallax effect per-se would also be gsap, as their timelines provide a lot of flexibility and options.
Their most advanced stuff is reserved for subscribers, but even if you limit yourself to the free plugins, you're still getting more than from alternative libs/plugins, IMHO.
See it working.

How can I keep a fixed (yet changing) image on the right hand of the screen while having the content on the left keep scrolling?

I'm thinking of something similar to remix.run, where there's a product image that is changing out as the user scrolls, but it feels like it's fixed to that side of the screen. I'm really not too sure how to describe it and that's why I'm struggling to find a tutorial! (I'll be trying to do this with React and Tailwind, just for some added context!)

swipeable carousel with dynamic height

I have an app in meteor .I want to read my websites feeds in a carousel with dynamic height . I have (read more) button at the bottom of each slides . witch carousel plugin is suitable for this goal?
If your plan is for React, I'd go for react-swipeable-views which also supports virtualization for any number of pages left-right and pre-rendering at number of slides ahead or back.
With this library you have some listeners so you can check the hight of a slide after rendering and set the height of the slide container dynamically. Since you are on mobile, the experience should be ok if most of your articles are longer than the viewport. When you load a new slide you would call something like window.scrollTo(0, 0) to start at the top.

scroll pic with fixed position

Good day, I'm having a problem achieving scrolling image with fixed position.
I have done half way of achieving what i wanted by creating two background images with fixed positions, (1 is normal, 2 is gray scaled).
once i upload it into wp site, they stay in background + they stay positioned at the top left of the page, (even after i specify their location, but images fixed to the view port, which what i don't want).
here's the link of my code: [https://jsfiddle.net/rf759hw3/1/][1]
now what i wanted to achieve is:
1 - keeping images in specified position while scrolling.
2 - once i reach to page section which has image, only then scrolling start from greyscale, to original (not while i scroll the page itself).
i found a website which achieve same concept which I'm looking to achieve:
http://tnc.org.cn/#TNC#events (the river section)
but their heavily filled with JS with many dependencies, and i am not yet familiar with js btw.
after days of research i found something which can achive my purpose using js called "Magic Scroll" , but i couldn't find an example which suites my purpose to achieve, which is keeping my images in position as i scroll and overlap one another when i reach their section , any advice or help is much appreciated. Thanks

Boostrap carousel show 3 images per slide truncated

I'm trying to set up a Bootstrap 3 carousel to show 3 images per active slide, I want the next and previous images to be truncated but the centre image full width, similar to this example: https://thescene.com/.
I've played around with this for quite a while but can't seem to get the truncated effect? My initial idea is to have the containing div full width to show all 3 images in full with an overflow:hidden property to get the effect, but the carousel itself needs to be 1280px wide. Codeply is here: http://www.codeply.com/go/6eBfBskTsV
Why not grab one online? This component seems has a partial nearby image effect...
http://www.jssor.com/index.html
The bootstrap carousel is just a simple implementation rather than a universal solution, which means it can be cumbersome to tweak to achieve some complicated presentation. I guess unless you are just practising your skills, you won't like to make one by yourself.

Resources