所以我试图在一个页面上运行两个不同的幻灯片,具体取决于窗口的大小。我已经制作了带有边缘动画的幻灯片,现在我遇到了无法运行这两个脚本的问题。当我尝试他们两个变得隐形时。
这是我到目前为止所做的:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript">
$(window).resize(function(){
var winW = $(window).width()
var menu = $('#clear')
if(winW < 768){
$('#clear').hide();
}
else {
$('#clear').show();
}
});
</script>
<script>
var custHtmlRoot="edgeanimate_assets/Slideshow/Assets/";
var script = document.createElement('script');
script.type= "text/javascript";
script.src = custHtmlRoot+"edge_includes/edge.6.0.0.min.js";
var head = document.getElementsByTagName('head')[0], done=false;
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
done=true;
var opts ={
scaleToFit: "both",
centerStage: "horizontal",
minW: "0px",
maxW: "800px",
width: "600px",
height: "468px"
};
opts.htmlRoot =custHtmlRoot;
AdobeEdge.loadComposition('Slideshow', 'EDGE-15997909', opts,
{"dom":{}}, {"dom":{}});
script.onload = script.onreadystatechange = null;
head.removeChild(script);
}
};
head.appendChild(script);
</script>
<style>
.edgeLoad-EDGE-15997909 { visibility:hidden; }
</style>
<script>
var custHtmlRoot="edgeanimate_assets/Swipe_Slideshow/Assets/";
var script = document.createElement('script');
script.type= "text/javascript";
script.src = custHtmlRoot+"edge_includes/edge.6.0.0.min.js";
var head = document.getElementsByTagName('head')[0], done=false;
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
done=true;
var opts ={
scaleToFit: "both",
centerStage: "horizontal",
minW: "0px",
maxW: "600px",
width: "600px",
height: "400px"
};
opts.htmlRoot =custHtmlRoot;
AdobeEdge.loadComposition('Swipe_Slideshow', 'EDGE-23145440', opts,
{"dom":{}}, {"dom":{}});
script.onload = script.onreadystatechange = null;
head.removeChild(script);
}
};
head.appendChild(script);
</script>
<style>
.edgeLoad-EDGE-23145440 { visibility:hidden; }
</style>
</head>
有没有办法在resize if else函数中运行这些脚本?如果是这样,我该怎么做?