How can I config. so that LAN 1 goes to WAN 1, and LAN 2 goes to WAN 2 with "failover"?

Dear sir,
I am able to config so that 2 LANs can go to the different WANs, which are LAN1 goes to WAN1 and LAN2 goes to WAN2. Now, the problem is when WAN1 goes down, LAN1 cannot access an Internet. How can I do so that LAN1 can access an Internet when WAN1 goes down?
Could you please give me an example.

Thank you.

Usually its best to design functionality with the whole in mind, meaning I would not want to separate at least initially, from how you assign the LANs to the WANs without taking failover into consideration in the intitial design. This leads to the next question of how is your network setup to begin with, ie. use bridges??

If you post your config that would be best for us to see what you have and where to go next

type /export hide-sensitive file=helpmewithfailover

Pardon me for asking but is there a specific “need” to have the traffics behave in this way?
You could simplify your life massively by using a PCQ load balanced queue and balancing over the 2 connections which would introduce failover as well.

As Stevo intimated the requirements are not fully flushed out.
Unlike Stevo I would not presume to provide a solution without understanding the requirements first.
For example you have not indicated if you want both LANS to have failover (ie LAN1 to WAN2 and LAN2 to WAN1)
Do you have any servers on your LANS (port forwarding type scenario)?
Are the WANs equally weighted, or is one faster than another.
Are there any acceptions or likely to be in terms of LAN1 or LAN2 clients actually needing access to an opposite WAN
(example email is associated with provider on WAN and all LAN users 1 and 2 use that email provider).