Room-by-room renovation: the complete method to organize your work without exceeding your budget

.en-bref { max-width: 640px; margin: 2em auto; padding: 1.5em 1.8em; color: #78350f; font-family: “Inter”, “Segoe UI”, sans-serif; text-align: left; position: relative; box-sizing: border-box; background: #fffaf0; border: 1px solid #b45309; border-left: 6px solid #b45309; border-radius: 8px; box-shadow: 0 8px 24px rgba(251, 191, 36, 0.15); }
.en-bref h2, .en-bref .en-bref-header { font-size: 1.15em; font-weight: 700; margin-bottom: 0.6em; color: #b45309; }
.en-bref p, .en-bref li { font-size: 1em; line-height: 1.65; margin: 10px; }
.en-bref strong { color: #451a03; }
.key-takeaways { max-width: 640px; margin: 2em auto; padding: 1.5em 1.8em; color: #78350f; font-family: “Inter”, “Segoe UI”, sans-serif; text-align: left; position: relative; box-sizing: border-box; background: #fffaf0; border: 1px solid #b45309; border-left: 6px solid #b45309; border-radius: 8px; box-shadow: 0 8px 24px rgba(251, 191, 36, 0.15); }
.key-takeaways h2, .key-takeaways .key-takeaways-header { font-size: 1.15em; font-weight: 700; margin-bottom: 0.6em; color: #b45309; }
.key-takeaways p, .key-takeaways li { font-size: 1em; line-height: 1.65; margin: 10px; }
.key-takeaways strong { color: #451a03; }
.key-takeaways ul { list-style: none; padding-left: 0; }
.key-takeaways li { margin: 0.45em 0; padding-left: 0.2em; }
.mg-callout{margin:1.5em 0;padding:.9em 1.1em;border:1px solid;border-left-width:4px;border-radius:10px;font-size:.97em;line-height:1.65}.mg-callout>:first-child{margin-top:0}.mg-callout>:last-child{margin-bottom:0}.mg-callout__label{display:block;margin:0 0 .35em;font-weight:700;font-size:.82em;letter-spacing:.03em;text-transform:uppercase}.mg-callout__label::before{margin-right:.45em;font-size:1.05em;vertical-align:-.06em}.mg-callout–info{background:#eff6ff;border-color:#bfdbfe;color:#1e3a5f}.mg-callout–info .mg-callout__label{color:#2563eb}.mg-callout–info .mg-callout__label::before{content:”2139FE0F”}.mg-callout–tip{background:#f0fdf4;border-color:#bbf7d0;color:#14532d}.mg-callout–tip .mg-callout__label{color:#15803d}.mg-callout–tip .mg-callout__label::before{content:”1F4A1″}.mg-callout–warning{background:#fffbeb;border-color:#fde68a;color:#7a4a10}.mg-callout–warning .mg-callout__label{color:#b45309}.mg-callout–warning .mg-callout__label::before{content:”26A0FE0F”}.mg-callout–danger{background:#fef2f2;border-color:#fecaca;color:#7f1d1d}.mg-callout–danger .mg-callout__label{color:#dc2626}.mg-callout–danger .mg-callout__label::before{content:”1F6D1″}.mg-proscons{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:1.5em 0}@media(max-width:560px){.mg-proscons{grid-template-columns:1fr}}.mg-proscons__col{padding:.9em 1.1em;border:1px solid;border-radius:10px}.mg-proscons__title{display:flex;align-items:center;gap:.4em;margin:0 0 .5em;font-weight:700;font-size:.9em;letter-spacing:.02em}.mg-proscons__col ul{margin:.3em 0 0;padding-left:1.15em}.mg-proscons__col li{margin:.3em 0;line-height:1.55}.mg-proscons__col–pro{background:#f0fdf4;border-color:#bbf7d0;color:#14532d}.mg-proscons__col–pro .mg-proscons__title{color:#15803d}.mg-proscons__col–pro .mg-proscons__title::before{content:”2705″}.mg-proscons__col–con{background:#fef2f2;border-color:#fecaca;color:#7f1d1d}.mg-proscons__col–con .mg-proscons__title{color:#dc2626}.mg-proscons__col–con .mg-proscons__title::before{content:”274C”}.mg-steps{list-style:none;counter-reset:mgstep;margin:1.5em 0;padding:0}.mg-steps__item{counter-increment:mgstep;position:relative;padding:0 0 1.1em 3.2em;min-height:2.4em}.mg-steps__item:last-child{padding-bottom:0}.mg-steps__item::before{content:counter(mgstep);position:absolute;left:0;top:0;width:2.2em;height:2.2em;line-height:2.2em;text-align:center;border-radius:50%;background:#2563eb;color:#fff;font-weight:700;font-size:.95em}.mg-steps__title{margin:.15em 0 .3em;font-weight:700}.mg-steps__item>:last-child{margin-bottom:0}.mg-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:14px;margin:1.5em 0}.mg-kpi{padding:1em .9em;border:1px solid #e5e7eb;border-radius:12px;background:#f9fafb;text-align:center}.mg-kpi__value{display:block;font-size:1.7em;font-weight:800;line-height:1.15;color:#111827}.mg-kpi__label{display:block;margin-top:.35em;font-size:.85em;color:#6b7280;line-height:1.35}

.wp-block-image,.ai-image{margin-bottom:1.75em}.wp-block-image>figcaption,.ai-image>figcaption{margin-top:.5em}

Renovating room by room allows for gradual progress, but it does not mean renovating spaces at random. The order of interventions, the initial condition of the home, work common to several rooms, and indirect expenses can greatly affect the home renovation budget.

This guide offers a concrete roadmap: diagnose the home, prioritize urgencies, estimate each item, choose the order of renovation work, compare quotes, and track expenses until completion. The amounts indicated remain indicative benchmarks to be confirmed according to the area, location, materials, and actual quotes obtained.

In brief

  • 🧭 Start with work that concerns the whole house: structure, roof, networks, insulation, and ventilation.
  • 💶 For light renovation, budget about €200 to €500 per m²; a complete renovation is rather around €850 to €1,500 per m², to be confirmed by quotes.
  • 🧰 Set aside 10 to 15% of the budget for unforeseen expenses and do not use it to improve finishes during the work.
  • 📋 Have at least two comparable quotes drawn up for each trade and record each expense in a single table.

Start with a complete assessment of the home

Before choosing a paint color or flooring, inspect the home as a whole. A leak, degraded electrical installation, or poor ventilation can make part of the finishes done too early useless. The initial diagnosis helps avoid paying twice for the same work.

Inspect each room before planning finishes

Visit each room with a tape measure, a notebook, and, if possible, dated photographs. Note the area, condition of walls and floors, water inlets and outlets, electrical outlets, windows, signs of moisture, and equipment to keep. For an apartment, add condominium constraints: schedules, access, debris removal, or prior authorization.

This first visit should also reveal dependencies. Moving a kitchen often means redoing plumbing, electricity, ventilation, and sometimes the floor. A renovated bathroom may require a waterproofing check before laying coverings.

  • Take measurements and ceiling height.
  • Photograph networks, electrical panels, water inlets, and damaged areas.
  • Identify materials potentially containing asbestos or lead in affected homes.
  • Check access, common areas, and storage possibilities.
  • Note equipment to remove, reuse, or replace.

Distinguish emergencies from comfort work

Then classify each intervention into a category. Emergencies notably concern infiltrations, structural problems, electrical risks, waterproofing defects, and situations that can quickly worsen the property’s condition. Energy performance work follows when the home has significant losses or lasting discomfort.

Aesthetic finishes, like painting or replacing still sound flooring, can be planned after networks and dirty work. This hierarchy does not mean decoration is secondary; it mainly prevents damaging it during a later technical intervention.

A finish done before repairing a network or infiltration can become an expense to redo, not a saving.

What budget to plan for room-by-room renovation?

For a first estimate, available benchmarks place light renovation around €200 to €500 per m² and complete renovation around €850 to €1,500 per m². These ranges are not contractual prices: they include very different levels of work and must be compared with detailed quotes.

Defining the Level of Renovation

Work Level Typical Content Indicative Order of Magnitude Point of Attention
Refresh Painting, small patching, floors or equipment retained About €200 to €500/m² The actual condition of the supports may broaden the scope
Intermediate Renovation Several coverings, partial networks, joinery or equipment About €500 to €1,000/m² Plumbing and electrical repairs are often underestimated
Complete Renovation Networks, redistribution, insulation, heating and finishes About €850 to €1,500/m² A degraded structure or roof can significantly increase the cost
Very Heavy Case Major removal, heavily degraded housing, multiple repairs Up to about €2,000/m² or more depending on the property A technical visit is essential before any commitment

As an indication, a complete renovation of 100 m² can reach about €120,000 depending on the level of repair and the services chosen. This amount should not be automatically transferred to another property: location, surface area, accessibility, and choice of finishes directly affect the price.

List All Site Expenses

The cost of renovating a room is not limited to visible supplies. Add labor, removal, waste disposal, delivery, protection of retained parts, possible studies, parking fees, and temporary solutions during the work.

Item Indicative Reference Why to Plan Separately
Demolition and Earthworks About €7,200 for an example of a 100 m² house The volume of rubble and access to the property change the bill
Electricity and Ventilation About €12,000 for an example of a 100 m² house The number of circuits, sockets and equipment influences the quote
Insulation About €5,000 to €30,000 depending on the scope Surfaces, technique and building constraints are decisive
Heating About €5,000 to €20,000 depending on the solution Power, emitters and network adaptations matter
Windows and Joinery About €3,000 to €15,000 The number of openings, dimensions and material affect the price
Plumbing About €2,000 to €10,000 Moving water points costs more than a simple replacement
Lire aussi :  How to make a wood lathe?

These amounts are orders of magnitude based on market references and not guaranteed prices for 2026. Materials and labor evolve; therefore, request a quote describing quantities, references, deadlines, applicable VAT, and exclusions.

Plan a Contingency Reserve

Set aside 10 to 15% of the work budget for discoveries after removal, support repairs, network modifications or delays. This amount should remain separate from the decoration budget. If spent, note the cause and possibly reduce a non-priority item rather than eliminate a safety intervention.

For example, on a budget of €60,000, a 10% reserve represents €6,000. The budget actually allocated to planned work is then €54,000, unless the reserve remains unused. This example is indicative and does not predict the real probability of an unforeseen event.

Which Room to Start a Complete Renovation With?

Start with work that affects several rooms or that may damage finishes: roof, structure, networks, insulation, heating, ventilation and electrical distribution. Then move from the most technical rooms to simpler spaces, finishing with floors, walls and decorative equipment.

Start with the work common to the entire dwelling

When several rooms are involved, first plan the cross-cutting interventions. Electrical upgrades, new ventilation, or interior insulation may require openings in several walls and ceilings. Doing these before painting limits rework.

The roof, leaks, and structural elements take priority when they present a risk or active deterioration. For electricity, gas, structure, complex waterproofing, or work at height, hire a competent company and verify the necessary qualifications.

Organize the rooms according to their complexity

The kitchen and bathroom concentrate networks, custom furniture, appliances, and waterproofing constraints. They are therefore generally treated before the bedrooms and living room, especially if pipes need to be moved. Bedrooms can then be renovated with fewer technical dependencies.

A coherent renovation work order often looks like this:

  1. Repair the structure, roof, and leaks.
  2. Work on general networks: electricity, water, heating, and ventilation.
  3. Treat insulation and joinery when the project requires it.
  4. Renovate the kitchen and bathroom.
  5. Install coverings, carry out painting, and install equipment.
  6. Finish with baseboards, adjustments, finishing touches, and inspections.

The right order is not necessarily the one that allows quick occupancy of the first room: it is the one that reduces rework and overlapping interventions.

How to organize the renovation of each room: the steps

For each space, use the same preparation sheet: existing condition, objective, technical work, supplies, responsible craftsman, planned budget, deadline, and acceptance criteria. This method transforms room-by-room renovation into a succession of verifiable lots rather than a list of ideas difficult to manage.

Room-by-room renovation of a kitchen under construction with exposed networks and protected materials
A kitchen must be planned around networks, final measurements, and equipment delivery.

Step 1: Define the expected result

Write down what must change and what must remain. In a bedroom, the goal may be to redo the walls and floor without modifying the outlets. In a kitchen, it may include moving the sink, replacing the countertop, and creating suitable electrical circuits.

The expected result must be observable: “two additional protected and tested circuits” is more useful than “improve the electricity.” This precision facilitates comparing quotes and the final inspection.

Step 2: Handle networks before finishes

Have electrical, plumbing, heating, or ventilation interventions done before the final coverings. Do not close a partition or cover a network without verifying its placement and keeping photographs.

In the bathroom, waterproofing and drainage must be validated before tiling. An Italian-style shower notably requires proper preparation of the support and drainage; consult the necessary skills before undertaking a sensitive intervention yourself.

Step 3: Order materials at the right time

Order long-lead products after validating measurements: joinery, kitchen furniture, shower screens, doors, or custom elements. Ordering too early may become unusable if dimensions change; ordering too late may immobilize craftsmen and extend the rental of temporary housing.

  • Validate dimensions after preparing supports.
  • Check references, colors, and quantities upon delivery.
  • Store materials in a dry place compatible with their nature.
  • Keep invoices, manuals, and batch references.

Step 4: Apply the finishes and inspect the room

Floors, paint, baseboards, and decorative elements come after the dusty work. In a dry room, a flexible covering can sometimes be installed over a properly prepared existing substrate; however, the installation of linoleum must comply with the manufacturer’s requirements regarding flatness, moisture, and floor preparation.

At the end of the room, check alignments, joints, openings, outlets, drains, and impact marks. Note any reservations immediately with a photograph and a date.

What order should be followed for the kitchen, bathroom, and living areas?

The kitchen and bathroom usually come before the living spaces when network work is required. Bedrooms and the living room can follow, as their finishes are less dependent on plumbing. However, the final order depends on whether it is possible to live in the home during the renovation.

Kitchen: lock in measurements before ordering

Start by confirming water inlets, drainage, electrical circuits, ventilation, and appliance locations. The countertop, furniture, and backsplash must be consistent with the final dimensions of the walls and equipment.

If the project only concerns the countertop, check who can perform the removal, cutting, and connections. This distinction avoids entrusting a plumbing or electrical modification to an unsuitable contractor. To choose a covering, also compare materials and maintenance constraints in this comparison of kitchen backsplashes.

Bathroom: address water issues before aesthetics

The bathroom requires special attention to waterproofing, slopes, drainage, and ventilation. Plan inspections before closing walls and before installing coverings. The bathroom budget often focuses on equipment, plumbing, substrate preparation, and labor, not just the price of tiles.

A complete bathroom renovation is more complex than replacing a cabinet or faucet. For a walk-in shower project, read the technical constraints presented in this guide on installing a walk-in shower at home, then call a professional if waterproofing or structure exceeds your skills.

Lire aussi :  How long should you let a silicone sealant dry before using the bathroom?

Bedrooms, living room, and dining room: group clean work

Group wall preparation, painting, and floor installation operations when the substrates are similar. This can reduce tool changes and facilitate coordination, but do not order all finishes before confirming the condition of the substrates.

Bedrooms can be prioritized if they need to remain available during the rest of the work. The living room, often through-passage and used to store furniture, should be protected rather than turned into a permanent storage area.

Entryway, hallways, and ancillary spaces: finish without neglecting them

Hallways and the entryway endure traffic, impacts, and dirt. It is generally better to paint and install their finishes after transporting materials and removing debris. Plan switches, outlets, lighting, and storage before closing the walls.

How to compare quotes and choose contractors?

A usable quote precisely describes the work, quantities, supplies, labor, deadlines, payment terms, and exclusions. Request at least two quotes per trade, provided from the same specifications. A lower price is only comparable if the scope, products, and guarantees are truly equivalent.

Request truly comparable quotes

Prepare an identical file for each company: scaled plans or sketches, photographs, list of equipment, desired finish level, and access constraints. Request that variants be separated from the base price. You can then arbitrate between a standard option and a more expensive option without mixing services.

Check in particular:

  • the exact designation of materials and their quantity;
  • the preparation of the surfaces and the protection of the dwelling;
  • the removal, waste disposal, and cleaning;
  • the intervention deadlines and any penalties provided for in the contract;
  • the applied VAT and payment conditions;
  • the insurances and guarantees communicated by the company.

Negotiate without degrading quality

The safest negotiation first concerns the scope and schedule. You can request a material variant, group interventions, or carry out a non-technical preparation yourself, if accepted by the craftsman. Avoid removing protection, ventilation, waterproofing, or control to reach a target amount.

Ask for an explanation when a price seems abnormally low: excluded supply, insufficient quantity, different finish, or subcontracted intervention may explain the difference. An incomplete quote does not become advantageous because its total is lower.

How to monitor the budget and deadlines during the work?

Use a single table with one row per item and a column for the planned budget, accepted quote, deposits paid, invoices received, balance to be paid, and variance. Add the planned date, actual date, and impact on other participants. This method makes overruns visible before they become irreversible.

Create a simple tracking table

Item Planned budget Committed amount Paid Balance to pay Variance
Electricity According to quote Accepted quote Deposit and invoices Committed minus paid Actual minus planned
Kitchen Furniture and installation separate Validated orders Payments made Supplier balance Added options
Painting and flooring Estimated surface and yield Purchases made Invoices received Remaining services Additional preparation

Manage changes during the work

A change must be documented before execution: description, price, impact on the deadline, and validation by the responsible person. This rule also applies to an apparently minor request, such as an additional outlet or a tile modification.

Delays can generate indirect costs: temporary housing, storage, delayed delivery, or additional intervention. If a material is missing, immediately request a new date and check which tasks can be advanced without causing rework.

Every change validated after the start must appear in the tracking as a budget decision, never as a simple worksite detail.

Reduce costs without compromising safety

The most cautious savings concern finishing choices, keeping equipment still functional, and logistical preparation. They must not affect protections, cable sections, waterproofing, ventilation, safety devices, or required skills.

Energy renovation can also reduce operating expenses, but the real savings depend on the dwelling, habits, climate, and energy price. A study on works carried out at the end of 2022 indicated an average saving of €793 per year and a reduction of 3 tons of CO2 per year; this benchmark does not constitute a guarantee for a particular project.

What alternatives to compare to renovate without exceeding your budget?

The choice is not limited to “do everything” or “do nothing.” You can compare a global renovation, a room-by-room renovation, or a targeted intervention on emergencies. The best option depends on the safety of the dwelling, the availability of funding, and your ability to endure the duration of the work.

Strategy Suitable if… Advantage Limit
Complete renovation The dwelling is vacant and the networks are very degraded Single coordination and fewer reworks between phases High initial budget and significant financing needed
Room-by-room renovation The dwelling remains occupied or the envelope is gradually freed Expenses spread out and possibility to adjust priorities Longer total duration and risk of price increases
Targeted work A technical or energy emergency dominates the project Quick response to the main problem The overall aesthetic result may be postponed

If the dwelling has infiltration or an electrical risk, choose the priority targeted intervention. If the networks are consistent and you have a vacant dwelling, complete renovation can reduce interfaces between craftsmen. If you must continue living there, room-by-room renovation is often more bearable, provided a living area is protected.

What aids and financing solutions to check in 2026?

The main schemes to examine are MaPrimeRénov’, energy savings certificates bonuses, the zero-interest eco-loan, and the reduced VAT when conditions are met. The criteria depend notably on the dwelling, the works, income, the company, and the application timeline; verify each rule on France Rénov’, Service-Public, and impots.gouv.fr before signing.

  • MaPrimeRénov’: the amount and the process vary according to the project and household situation.
  • CEE bonuses: compare offers and check the procedures to follow before committing to the works.
  • Eco-PTZ: it can finance up to €50,000 of energy renovation works without interest, subject to applicable conditions.
  • 5.5% VAT: it may apply to certain energy renovation works when fiscal and technical criteria are met.
Lire aussi :  Why choose a steel front door: robustness, design, and performance guaranteed

Never deduct aid from the budget before verifying your eligibility and obtaining the necessary documents. A financing solution proposed by a company, including a formula without loan or monthly payments, must be studied according to its conditions, its consequences on the property, and its overall cost; it does not replace a comparison with a conventional bank financing.

What mistakes to avoid in room-by-room renovation?

Overruns rarely come from a single purchase. They rather result from decisions made too early, an incomplete quote, or an order of intervention that causes reworks. Here are the most frequent traps and how to limit them.

  • Starting with painting: a network or partition rework can damage it. First handle technical interventions.
  • Comparing only totals: two quotes may exclude removal, supplies, or disposal. Compare line by line.
  • Using the contingency for an aesthetic option: you expose the site to a cash shortage. Keep 10 to 15% for unforeseen expenses.
  • Ordering custom-made before removal: final dimensions may change. Measure after preparing the supports.
  • Accepting a delay without recalculation: a shift can lead to storage, accommodation, or new delivery. Record its impact in the follow-up.

How to build a realistic renovation schedule?

Break down the home renovation schedule into phases rather than too precise dates. First plan the diagnosis and orders, then dirty works, networks, supports, finishes, and inspections. Add margins between trades, as one intervention cannot always start the same day the previous one ends.

Anticipate daily life constraints

If the dwelling remains occupied, designate a safe room, protect passageways, and ensure access to a water point and sanitary facilities. A kitchen unavailable for several weeks requires a temporary solution; its cost should be included in the initial budget.

For an apartment, inquire with the property management and the town hall when the nature of the work justifies it. A modification of the facade, openings, structure, or purpose may require authorization. Do not start any work subject to approval before obtaining the corresponding response.

How to verify the completion of the work?

Acceptance should not be limited to noting that the room appears finished. Test the equipment, check the finishes, and compare the result to the estimate and plans. A precise, photographed, and dated reservation is more useful than a general remark made several weeks after the company has left.

  • Test switches, sockets, lighting, faucets, and drains.
  • Check the opening of doors, windows, furniture, and drawers.
  • Inspect joints, baseboards, connections, paint, and visible surfaces.
  • Check for absence of leaks or moisture traces after using water points.
  • Gather invoices, manuals, certificates, warranties, and photographs of networks before closure.

Also keep signed estimates, amendments, acceptance reports, and important correspondence. These documents facilitate maintenance, any subsequent intervention, or renting out the dwelling. For the latter project, consult the obligations detailed in this landlord owner’s guide.

Useful sources to consult

France Rénov’ allows you to verify the pathways and aids related to energy renovation. Service-Public.fr provides information on authorizations, obligations, and administrative procedures. Impots.gouv.fr specifies the VAT rules applicable depending on the nature of the work and the dwelling.

For technical requirements, ask companies for the normative references applicable to their scope and their insurance certificates. The prices presented in this article are orders of magnitude based on market benchmarks; only a diagnosis and estimates adapted to your dwelling can establish a usable budget.

Key takeaways

  • 🧭 Diagnose the entire dwelling before choosing finishes.
  • 💶 Separate priority work, comfort, and decoration in the budget.
  • 🛠️ Start with networks, waterproofing, and interventions involving several rooms.
  • 📊 Keep a reserve of 10 to 15% and record each amendment.
  • ✅ Accept each room with tests, photographs, and preserved documents.

A room-by-room renovation remains manageable when each space has a purpose, a budget, a responsible party, and a completion condition. By addressing risks and networks first, then locking in estimates and orders, you reduce rework without sacrificing safety or quality.

Frequently asked questions

Which room should you start a complete renovation with?

Start with emergencies, common networks, and technical rooms such as the kitchen or bathroom. Bedrooms and living spaces can follow once dusty work and embedded interventions are finished.

What margin should be planned for unforeseen events?

A reserve of 10 to 15% of the work budget is a prudent benchmark often used for unforeseen events. The percentage should be adapted to the age of the dwelling, its condition, and the level of dismantling planned.

Should all rooms be renovated at the same time?

No. A global renovation can reduce interfaces between craftsmen in an empty dwelling, while a room-by-room renovation spreads expenses and facilitates daily life. The choice mainly depends on the condition of the networks, financing, and the possibility of occupying the dwelling.

How to save on a renovation without taking risks?

Compare estimates with the same scope, keep reusable equipment, and first arbitrate on finishes. Do not reduce expenses devoted to electricity, gas, waterproofing, ventilation, structure, or protections.

When should you call a qualified professional?

Call a professional for work related to gas, structure, complex electricity, roofing, waterproofing, or work at height. A company may also be necessary to meet the access conditions for certain aids.

.magic-lb-overlay{position:fixed;inset:0;background:rgba(15,23,42,.92);display:none;align-items:center;justify-content:center;z-index:99999;cursor:zoom-out;padding:20px}
.magic-lb-overlay.open{display:flex}
.magic-lb-overlay img{max-width:95vw;max-height:95vh;object-fit:contain;border-radius:8px;box-shadow:0 8px 32px rgba(0,0,0,.5)}
.magic-lb-close{position:absolute;top:16px;right:20px;color:#fff;background:rgba(0,0,0,.5);border:none;width:40px;height:40px;border-radius:50%;font-size:24px;cursor:pointer;display:flex;align-items:center;justify-content:center}
.magic-lb-close:hover{background:rgba(0,0,0,.8)}
.wp-block-image img{cursor:zoom-in;transition:transform .15s ease}
.wp-block-image img:hover{transform:scale(1.01)}
.magic-img-link{display:inline-block;text-decoration:none}

(function(){
var ov=document.getElementById(‘magic-lb’);if(!ov)return;
var img=ov.querySelector(‘img’),btn=ov.querySelector(‘.magic-lb-close’);
function open(src){img.src=src;ov.classList.add(‘open’);document.body.style.overflow=’hidden’}
function close(){ov.classList.remove(‘open’);img.src=”;document.body.style.overflow=”}
document.addEventListener(‘click’,function(e){
var a=e.target.closest(‘a.magic-img-link’);
if(a){e.preventDefault();open(a.getAttribute(‘href’));return}
var i=e.target.closest(‘.wp-block-image img’);
if(i&&!e.target.closest(‘a’)){e.preventDefault();open(i.currentSrc||i.src)}
});
ov.addEventListener(‘click’,function(e){if(e.target===ov||e.target===btn)close()});
document.addEventListener(‘keydown’,function(e){if(e.key===’Escape’)close()});
})();

bricospirit

Leave a Comment