ElementorPortfolioWordPress

How To Make One-Click Responsive Preview for Your Website

Tools and Links Used

Hostinger Fast, beginner friendly WordPress hosting.
Get Hosting
Elementor The free page builder this tutorial is built with.
Get Elementor
Elementor Pro The Pro upgrade used throughout this tutorial.
Get Elementor Pro
Project Files Download the resources used in this tutorial.
Download Files
Kitpapa Ready made Elementor template kits.
Get Templates
Kitninja eCommerce Elementor template kits.
Get Templates

Prompt Used in This Tutorial

Responsive Buttons Style CSS
<style>
.iframe-section {
    width: 100%;
    text-align: center;}
 
 

.iframe-wrapper {
    width: 100%;
    height: calc(100vh - 80px);
    transition: all 0.6s ease;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    background: white;
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: inline-block;
    transition: all 0.6s ease;
}



.btn .elementor-button-icon{
    font-size: 18px;
}
    
    
  /* Tablet view */
.tablet-view .preview-frame {
    max-width: 768px;
}

/* Mobile view */
.mobile-view .preview-frame {
    max-width: 375px;
    }

.btn.active .elementor-button {
    background-color: white!important;
    fill: #36364A!important;
    color: #36364A!important;
    box-shadow: 0 4px 8px rgba(18, 43, 105, .08), 0 2px 6px rgba(18, 43, 105, .04), 0 1px 2px rgba(18, 43, 105, .08);
}
</style>
Responsive Buttons Style CSS Classes
btn
active
Responsive Buttons JS Code
<script>
document.addEventListener("DOMContentLoaded", function() {
    const body = document.body;
    const buttons = document.querySelectorAll(".btn");
    
function setActive(activeButton) {
     // Remove active class from all buttons
    buttons.forEach(btn => {
    btn.classList.remove("active");
    });
    // Add active class to clicked button
    activeButton.classList.add("active");
}
            
document.getElementById("btn-desktop").addEventListener("click", function() {
    body.className = ''; // Remove all view classes
   setActive(this);
});
            
document.getElementById("btn-tablet").addEventListener("click", function() {
    body.className = 'tablet-view'; // Set only tablet-view class
    setActive(this);
});
            
document.getElementById("btn-mobile").addEventListener("click", function() {
    body.className = 'mobile-view'; // Set only mobile-view class
    setActive(this);
    });
});
</script>
Responsive Buttons ID
btn-desktop
btn-tablet
btn-mobile
Iframe
<div class="iframe-wrapper">
    <iframe id="sitePreview" class="preview-frame" src="https://kitpapa.net/recipepro/"></iframe>
</div>
Iframe Container Class
iframe-section

Get Your FREE Freelancing Roadmap

Stop hopping between tutorials. Grab the Freelancing Mastery Handbook to learn how to choose a skill, build your foundation, find clients, and confidently start your freelancing journey.

Free eBook Download

Related Tutorials

From learning the right skills to building a stronger digital presence, we help you turn ideas into practical, professional results.

Vibe Code a REAL Animated WordPress Website with Claude + Elementor

21.8K views

View Tutorial

Vibe Coding Full Course for Beginners – Build & Launch a Real SaaS

3.3K views

View Tutorial

Edit Videos with ChatGPT Codex — Raw Clips to Finished Reel

3.4K views

View Tutorial

Browse All Tutorials