我遇到了jQuery multizoom插件的问题。 document.ready()
和window.load()
不会在主要功能上启动它。在页面加载
document.read()
或window.load()
,但插件无法启动。 请指导如何在页面加载时第一次加载。除了Document.ready()或window.load()
之外的任何其他事件由于
<script>
function slid_body(){
document.getElementById('slid_body').style.left = "0px";
//document.getElementById('slid_body').style.width = "804px";
}
function slideIn() {
//document.getElementById('slid_body').style.left = "0px";
document.getElementById('slid_body').style.left = "-804px";
}
</script>
<body onload="javascript:slid_body()">
<div id="slid_body_out">
<div id="slid_body">
<div id="heading">
<ul id="breadcrumbs">
<li>Collection</li>
<li>
Casual</li>
</ul>
<div id="left">
<div id="prodetail">
<div id="pro_dtl_left">
<div id="pro_dtl_leftimg">
<div class='targetarea'><img id='multizoom1' src='images/ProductImages/Medium/634981200372366040_XGN_6539.JPG' alt='zoomable'L32840'></img></div>
</div>
<div id="pro_dtl_right_moreviews">
<p>
Scroll on above image to view enlarged picture<br />
Use Mouse Scroll to Zoom in/out.
</p>
<li>More Views</li>
<br />
<span id="ctl00_ContentPlaceHolder1_litThumbs" style="display:inline-block;width:300px;"><ul><li class='multizoom1 thumbs'><a href='images/ProductImages/Medium/634981200372366040_XGN_6539.JPG' data-large='images/ProductImages/Original/634981200372366040_XGN_6539.JPG' data-title='L32840'><img src='images/ProductImages/thumb/634981200372366040_XGN_6539.JPG' alt='L32840' /></a></li><li class='multizoom1 thumbs'><a href='images/ProductImages/Medium/634982980662846576_XGN_6537.JPG' data-large='images/ProductImages/Original/634982980662846576_XGN_6537.JPG' data-title='L32840'><img src='images/ProductImages/thumb/634982980662846576_XGN_6537.JPG' alt='L32840' /></a></li><li class='multizoom1 thumbs'><a href='images/ProductImages/Medium/634982981340675266_XGN_6540.JPG' data-large='images/ProductImages/Original/634982981340675266_XGN_6540.JPG' data-title='L32840'><img src='images/ProductImages/thumb/634982981340675266_XGN_6540.JPG' alt='L32840' /></a></li><li class='multizoom1 thumbs'><a href='images/ProductImages/Medium/634982981855793870_XGN_6538.JPG' data-large='images/ProductImages/Original/634982981855793870_XGN_6538.JPG' data-title='L32840'><img src='images/ProductImages/thumb/634982981855793870_XGN_6538.JPG' alt='L32840' /></a></li></ul></span>
</div>
</div>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function ($) {
$('#multizoom1').addimagezoom({
descArea: '#description',
speed: 1000,
descpos: true,
imagevertcenter: true,
magvertcenter: true,
zoomrange: [3, 10],
magnifiersize: [500, 450],
magnifierpos: right,
cursorshadecolor: '#5C2E91',
cursorshade: true
});
})
</script>
</body>
答案 0 :(得分:0)
可能是body onload="javascript:slid_body()"
与$(document).ready
jQuery函数发生冲突。
试试这个,将脚本放在一个地方:
<body>
<div id="slid_body_out">
<div id="slid_body">
<div id="heading">
<ul id="breadcrumbs">
<li>Collection</li>
<li>
Casual</li>
</ul>
<div id="left">
<div id="prodetail">
<div id="pro_dtl_left">
<div id="pro_dtl_leftimg">
<div class='targetarea'><img id='multizoom1' src='images/ProductImages/Medium/634981200372366040_XGN_6539.JPG' alt='zoomable'L32840'></img></div>
</div>
<div id="pro_dtl_right_moreviews">
<p>
Scroll on above image to view enlarged picture<br />
Use Mouse Scroll to Zoom in/out.
</p>
<li>More Views</li>
<br />
<span id="ctl00_ContentPlaceHolder1_litThumbs" style="display:inline-block;width:300px;"><ul><li class='multizoom1 thumbs'><a href='images/ProductImages/Medium/634981200372366040_XGN_6539.JPG' data-large='images/ProductImages/Original/634981200372366040_XGN_6539.JPG' data-title='L32840'><img src='images/ProductImages/thumb/634981200372366040_XGN_6539.JPG' alt='L32840' /></a></li><li class='multizoom1 thumbs'><a href='images/ProductImages/Medium/634982980662846576_XGN_6537.JPG' data-large='images/ProductImages/Original/634982980662846576_XGN_6537.JPG' data-title='L32840'><img src='images/ProductImages/thumb/634982980662846576_XGN_6537.JPG' alt='L32840' /></a></li><li class='multizoom1 thumbs'><a href='images/ProductImages/Medium/634982981340675266_XGN_6540.JPG' data-large='images/ProductImages/Original/634982981340675266_XGN_6540.JPG' data-title='L32840'><img src='images/ProductImages/thumb/634982981340675266_XGN_6540.JPG' alt='L32840' /></a></li><li class='multizoom1 thumbs'><a href='images/ProductImages/Medium/634982981855793870_XGN_6538.JPG' data-large='images/ProductImages/Original/634982981855793870_XGN_6538.JPG' data-title='L32840'><img src='images/ProductImages/thumb/634982981855793870_XGN_6538.JPG' alt='L32840' /></a></li></ul></span>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#multizoom1').addimagezoom({
descArea: '#description',
speed: 1000,
descpos: true,
imagevertcenter: true,
magvertcenter: true,
zoomrange: [3, 10],
magnifiersize: [500, 450],
magnifierpos: right,
cursorshadecolor: '#5C2E91',
cursorshade: true
});
function slid_body(){
document.getElementById('slid_body').style.left = "0px";
}
function slideIn() {
document.getElementById('slid_body').style.left = "-804px";
}
slid_body();
})
</script>
</body>