Jump to content

Script Disabled - Trying to add google mazipano virtual tour to HTML block

Recommended Posts

Site URL: https://www.knowmacdonaldmedia.com/

I loaded the JQuery on my site. I opened the Squarespace editor home, and click on ‘Settings’, then ‘Advanced’, then ‘Code Injection’, and in the code input area, paste this:

<script type=”text/javascript” src=”//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js”></script>

 

This code supposed to create an html element, called an iframe, and connect the marzipano features and controls to the iframe, but after I closed the content box it just said "Script Disabled".

 

<div id='walkthrough' style='margin:auto;text-align:center;'></div>
<script>
// Place url of your deployed app here
const myUrl = 'https://2454-marneil-dr-drone-virtual-tour.netlify.app/';
const horizontalRatio = 16/9;
const verticalRatio = 3/4;
    
$(document).ready( function (){
    makeWalkthrough();
})
var myOrientation;
function makeWalkthrough () {
    const myWidth = window.innerWidth;
    const myHeight = window.innerHeight;
    let horizPadd;
    let newHeight;
    if (myWidth < 768) {
        horizPadd = 6
    } else {
        horizPadd = 11
    }
    const newWidth = (100 - (horizPadd*2));
    if ( myHeight >  myWidth) {
        newHeight = horizontalRatio * newWidth;
        myOrientation = 'vert'
    } else {
        newHeight = verticalRatio * newWidth;
        myOrientation = 'horz'
}

// Insert window for walkthrough
var marzipanoWindow = document.createElement("iframe");
marzipanoWindow.style = `height:${newHeight}vw; width:${newWidth}vw`;
marzipanoWindow.src = `${myUrl}/index.html`;
$("#walkthrough").append(marzipanoWindow);
}
$(window).resize( function (){
    if ( window.innerHeight > window.innerWidth && myOrientation === 'horz'){
        $("#walkthrough").empty();
        makeWalkthrough();
    } else if (window.innerHeight < window.innerWidth && myOrientation === 'vert') {
        $("#walkthrough").empty();
        makeWalkthrough();
    }
});
// script for Screenful
var scriptScreenful = document.createElement("script");
scriptScreenful.type = "text/javascript";
scriptScreenful.src = `${myUrl}/vendor/screenfull.min.js`;
$("head").append(scriptScreenful);
// script for Classlist
var scriptClassList = document.createElement("script");
scriptClassList.type = "text/javascript";
scriptClassList.src = `${myUrl}/vendor/classList.js`;
$("head").append(scriptClassList);
// script for bowser
var scriptBowser = document.createElement("script");
scriptBowser.type = "text/javascript";
scriptBowser.src = `${myUrl}/vendor/bowser.min.js`;
$("head").append(scriptBowser);  
// script for es5
var scriptEs5 = document.createElement("script");
scriptEs5.type = "text/javascript";
scriptEs5.src = `${myUrl}/vendor/es5-shim.js`;
$("head").append(scriptEs5);
// script for events
var scriptEvent = document.createElement("script");
scriptEvent.type = "text/javascript";
scriptEvent.src = `${myUrl}/vendor/eventShim.js`;
$("head").append(scriptEvent);
// script for animation
var scriptAnimation = document.createElement("script");
scriptAnimation.type = "text/javascript";
scriptAnimation.src = `${myUrl}/vendor/requestAnimationFrame.js`;
$("head").append(scriptAnimation);
// script for Marzipano
var scriptMarzipano = document.createElement("script");
scriptMarzipano.type = "text/javascript";
scriptMarzipano.src = `${myUrl}/vendor/marzipano.js`;
$("head").append(scriptMarzipano);
</script>

1588898255_SquareSpaceScriptDisabledContent.thumb.PNG.78af0b401c020a1fe93a0cef9558d85d.PNG

875208220_SquareSpaceScriptDisabled.thumb.PNG.d3634db319ef477c376386e3ae4717f2.PNG

Any help would be appreciated. Thank you in advance. 

 

Link to comment
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

I found an alternative that works. I used http://embedresponsively.com/ custum code:

<style>.embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style><div class='embed-container'><iframe src='https://2454-marneil-dr-drone-virtual-tour.netlify.app//' style='border:0'></iframe></div>

 

1974688679_SquareSpaceInbedCode-1.thumb.PNG.383a1e75fd19cd141957df5af226b65d.PNG

765040842_SquareSpaceInbedCode.thumb.PNG.3200c9ec0dfbad5dfc3339d0b5bb3fb3.PNG

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.