Well first off you should really consider not doing this. As Mozilla says when describing the Web Crypto API:
This API provides a number of low-level cryptographic primitives. It's very easy to misuse them, and the pitfalls involved can be very subtle.
Even assuming you use the basic cryptographic functions correctly, secure key management and overall security system design are extremely hard to get right, and are generally the domain of specialist security experts.
Errors in security system design and implementation can make the security of the system completely ineffective.
Please learn and experiment, but don't guarantee or imply the security of your work before an individual knowledgeable in this subject matter thoroughly reviews it. The Crypto 101 Course can be a great place to start learning about the design and implementation of secure systems.
If you're communicating from the server to your website, https will already handle the encryption. If you're communicating from peer to peer, WebRTC will already handle the encryption. If you're doing anything more complicated than that, you probably want to know more about what you're doing. Generally speaking you're going to want to use public-key cryptography on short data, such as message hashes or symmetric keys, as public-key algorithms tend to be fairly slow.
But, if all of this hasn't dissuaded you and you still don't think it's a bad idea, you can check out TweetNaCl, Elliptic, or eccrypto. None of these will do public key encryption of arbitrary data, but again, that's usually not what you want. They will implement ECDH and ECDSA, which are most likely what you want.
All of this took about five minutes to find by the way, given that I know what to look up. If you didn't that implies you don't know what you're doing and I would again strongly urge you to reconsider.
EDIT: As the commenter below pointed out, I was wrong. ECC is extremely vulnerable and can be beaten. I was misremembering and it's actually much better to use RSA for quantum resistance. Still, at this stage, NIST has only just (in 2022) approved post-quantum asymmetric algorithms. Right now quantum computers are limited in scope, so unless you're encrypting data which will still be valuable years down the line AND faces the risk of being targeted by an organization with access to the top of the line hardware, don't worry about it. Still I must maintain, if you are managing data that's that high of a risk it should be managed by someone who really knows what they're doing (more-so than I do, as evidenced by the above mistake).