0

我对 jQuery multizoom 插件有疑问。document.ready()并且window.load()不会在主要功能上启动它。在页面加载

  • div (#slide_body) 从左向右滑出。
  • 然后在这个 div(#slide_body) 中,我在图片上调用 jQuery 插件 Multizoom。
  • 由于 slide_body jQuery multizoom 没有加载。我已经尝试过document.read(),或者window.load()插件无法启动。
  • 如果我调整网页大小(Ctrl + 鼠标滚轮)然后它开始工作,因为它重新定位页面元素。
  • 或者,如果我单击拇指图像,它就会开始工作。但是第一个图像永远不会在页面加载上起作用。

请指导如何在页面加载时首次加载。除了 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>
4

1 回答 1

0

也许是body onload="javascript:slid_body()"$(document).readyjQuery 函数发生冲突的人。

试试这个,把脚本放在一个地方:

<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>
于 2013-04-12T15:07:02.597 回答