Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

96
Views
Multiple Video Play as a page Background Depends on Condition

I want to set different video as a background depends on weather condition for example while sunny condition then background video should be sunny cloudy weather should be cloud video. How can I do this in reactjs. All the video i have in assets folder of the project.

App js Code :

import Clear from "./Weatherconditions/Clear";
import Sunny from "./Weatherconditions/Sunny";
import Cloudy from "./Weatherconditions/Cloudy";
import Snow from "./Weatherconditions/Snow";
import Rainy from "./Weatherconditions/Rainy";

return (
    <div className="app"
    style={
      placeInfo.condition?.toLowerCase() === "clear" ? {Clear}:
      placeInfo.condition?.toLowerCase() === "sunny"? {Sunny}: 
      placeInfo.condition?.includes("cloudy")? {Cloudy }: 
      placeInfo.condition?.toLowerCase().includes("rainy")? {Rainy}: 
      placeInfo.condition?.toLowerCase().includes("snow")? {Snow}: {}}>

and one of the import section code :

for Clear:

import React from 'react';
import Videos from "../assets/clear.mp4";
const Clear = () => {
  return (
    <div>
        <video autoPlay loop muted style={{
            position: 'absolute',
            width: '100%',
            left: '50%',
            top: '50%',
            height: '100%',
            objectFit: 'cover',
            transform: 'translate(-50%, -50%)',
            zIndex: '-1'
        }}>
         <source src = {Videos} type="video/mp4"/> 
      </video>
    </div>
  )
}
export default Clear;

Please Help me

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!