What's your flavour of JS on the frontend?

Oh, I’m curious what made it slow? In my experience it’s been snappy. Animations were smooth and reacted immediately to my clicks.

2 Likes

I didn’t run a benchmark or something, but I ran some examples from the tutorial at Scrimba and they felt very slow even that the code was running on my computer not some mobile phone.

Otherwise AlpineJs is really a joy to use.

2 Likes

Why would you need JS for dropdown or hiding/showing elements unless you are doing a server response thing?

1 Like

Indeed you’re right for basic implementations that satisfy purely showing/hiding, but commonly I need to add/remove CSS classes when in an open or closed state and also for controlling CSS classes to trigger CSS animations.

One example I need some JavaScript for (and AlpineJS makes this declarative in the HTML) is mobile navigation menu drawers to open/close. I don’t want to use LiveView/server for controlling these UI elements since it’s not related to server-side data. I absolutely try to avoid using JavaScript where CSS alone works.

I don’t want to derail the thread, but happy to keep discussing in another thread!

2 Likes

The more I use Phoenix LiveView the less I need JS… But I still need it occasionally. When I do I use this amazing library called VanillaJS :laughing:

I do try to use VanillaJS as much as possible. However, part of me just can’t let go of jQuery. It’s an old comfort blanket and so easy to use that I still find myself using it.

2 Likes

That’s detectable via a CSS selector or so though depending on implementation, you shouldn’t need any CSS classes added/removed as it’s fully detectable in pure CSS as it is?

What javascript is required for this? I’m curious as at work I have mine as just pure CSS and HTML for the same functionality. It’s a lot more battery friendly and lower network usage this way as well. ^.^

That would make for an interesting thread! How to do things without javascript that is often done with javascript. ^.^ You should start it!

2 Likes

We are building a tool for our sales folks to help them during the pitch. The app shows current metrics of the potential customer, can run queries in Google to see how the customer is ranked, and soon will be able to make an offer and the contract.

2 Likes