与asp.net集成时,滑块脚本无法正常工作

时间:2012-12-18 13:20:04

标签: javascript jquery asp.net

我正在制作一个包含内容,图像和放大器的滑块。缩略图也。所以我开始研究following script,这工作正常。

现在我想在asp.net网站中整合相同的脚本,内容来自数据库。

我的asp.net滑块开始给我各种各样的问题,最终设法解决了大部分问题,除了我面对的一个我已经从asp.net网页输出创建HTML文件供你参考here

与工作示例中的代码几乎相同,我无法弄清楚为什么滑块无法在TEST.HTML页面上运行。

http://jsfiddle.net/WGqbb/

此问题已得到解决,问题出现在HTML标记中。

CODE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1"><title>

</title><meta http-equiv="content-type" content="text/html;charset=utf-8" /><link href="../styles/english_css.css" rel="stylesheet" type="text/css" /></head>
<body id="body"  dir="ltr">
    <form method="post" action="Default.aspx?language=en-us&amp;issue=5" id="frmMasterPage">


    <script src="http://demo.kashmirsouq.com/scripts/slider/jquery.js" type="text/javascript"></script>              
    <script src="http://demo.kashmirsouq.com/scripts/slider/jquery.easing.js" type="text/javascript"></script>
    <script src="http://demo.kashmirsouq.com/scripts/slider/script.js" type="text/javascript"></script>
<link href="http://demo.kashmirsouq.com/styles/slider-en.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    $(document).ready(function () {
        var buttons = { previous: $('#jslidernews2 .button-previous'),
            next: $('#jslidernews2 .button-next')
        };
        $('#jslidernews2').lofJSidernews({ interval: 5000,
            direction: 'opacity', // for fading effect
            easing: 'linear', // for fading effect
            //easing:'easeInOutQuad',  // for transition effect
            duration: 1200,
            auto: true,
            mainWidth: 590,
            mainHeight: 300,
            navigatorHeight: 76,
            navigatorWidth: 160,
            maxItemDisplay: 4,
            buttons: buttons
        });
    });

</script>
<style>

    ul.lof-main-wapper li {
        position:relative;    
    }
</style>



 <div id="jslidernews2" class="lof-slidecontent" style="width:750px; height:300px;">

            <div  class="button-previous">Previous</div>

             <!-- MAIN CONTENT -->



                    <div class="main-slider-content" style="width:590px; height:300px; float:right;">
                        <ul class="sliders-wrap-inner">
                            <li>
                                   <img  src="http://demo.kashmirsouq.com/images/article/94618045-044c-4977-a5d7-bf2a44f19f1e.png" />      
                                  <div class="slider-description">
                                    <h4>Sheikh Mohammed holds fast to his father’s le...</h4>
                                    <a class="readmore" href="#">Read more </a>
                                 </div>
                            </li>

                          </ul>      
                    </div>

                    <div class="main-slider-content" style="width:590px; height:300px; float:right;">
                        <ul class="sliders-wrap-inner">
                            <li>
                                   <img  src="http://demo.kashmirsouq.com/images/article/5daed017-e3aa-49d8-b477-ce607dfcbd51.png" />      
                                  <div class="slider-description">
                                    <h4>It’s time the Lebanese removed their shackles...</h4>
                                    <a class="readmore" href="#">Read more </a>
                                 </div>
                            </li>

                          </ul>      
                    </div>

                    <div class="main-slider-content" style="width:590px; height:300px; float:right;">
                        <ul class="sliders-wrap-inner">
                            <li>
                                   <img  src="http://demo.kashmirsouq.com/images/article/d158c479-6559-46c9-bae7-e7e04a1cbf9b.png" />      
                                  <div class="slider-description">
                                    <h4>Belarus is open for business</h4>
                                    <a class="readmore" href="#">Read more </a>
                                 </div>
                            </li>

                          </ul>      
                    </div>

                    <div class="main-slider-content" style="width:590px; height:300px; float:right;">
                        <ul class="sliders-wrap-inner">
                            <li>
                                   <img  src="http://demo.kashmirsouq.com/images/article/de155ceb-c148-495b-9aa0-ad1f9f0f463c.png" />      
                                  <div class="slider-description">
                                    <h4>A Royal Visit</h4>
                                    <a class="readmore" href="#">Read more </a>
                                 </div>
                            </li>

                          </ul>      
                    </div>

                    <div class="main-slider-content" style="width:590px; height:300px; float:right;">
                        <ul class="sliders-wrap-inner">
                            <li>
                                   <img  src="http://demo.kashmirsouq.com/images/article/ff435532-635a-4089-b7e3-858a305cbfed.png" />      
                                  <div class="slider-description">
                                    <h4>Building Dubai together</h4>
                                    <a class="readmore" href="#">Read more </a>
                                 </div>
                            </li>

                          </ul>      
                    </div>

                    <div class="main-slider-content" style="width:590px; height:300px; float:right;">
                        <ul class="sliders-wrap-inner">
                            <li>
                                   <img  src="http://demo.kashmirsouq.com/images/article/5a2d74a8-5ce8-4816-895b-7235ac2b3081.png" />      
                                  <div class="slider-description">
                                    <h4>Two new debuts from Mitsubishi</h4>
                                    <a class="readmore" href="#">Read more </a>
                                 </div>
                            </li>

                          </ul>      
                    </div>


                           <div class="navigator-content">
                              <div class="navigator-wrapper">
                                    <ul class="navigator-wrap-inner">
                                      <li>
                                            <div>
                                            <img  src="http://demo.kashmirsouq.com/images/article/94618045-044c-4977-a5d7-bf2a44f19f1e.png" />
                                            </div>    
                                        </li>              

                                    </ul>
                              </div>

                         </div>

                           <div class="navigator-content">
                              <div class="navigator-wrapper">
                                    <ul class="navigator-wrap-inner">
                                      <li>
                                            <div>
                                            <img  src="http://demo.kashmirsouq.com/images/article/5daed017-e3aa-49d8-b477-ce607dfcbd51.png" />
                                            </div>    
                                        </li>              

                                    </ul>
                              </div>

                         </div>

                           <div class="navigator-content">
                              <div class="navigator-wrapper">
                                    <ul class="navigator-wrap-inner">
                                      <li>
                                            <div>
                                            <img src="http://demo.kashmirsouq.com/images/article/d158c479-6559-46c9-bae7-e7e04a1cbf9b.png" />
                                            </div>    
                                        </li>              

                                    </ul>
                              </div>

                         </div>

                           <div class="navigator-content">
                              <div class="navigator-wrapper">
                                    <ul class="navigator-wrap-inner">
                                      <li>
                                            <div>
                                            <img  src="http://demo.kashmirsouq.com/images/article/de155ceb-c148-495b-9aa0-ad1f9f0f463c.png" />
                                            </div>    
                                        </li>              

                                    </ul>
                              </div>

                         </div>

                           <div class="navigator-content">
                              <div class="navigator-wrapper">
                                    <ul class="navigator-wrap-inner">
                                      <li>
                                            <div>
                                            <img  src="http://demo.kashmirsouq.com/images/article/ff435532-635a-4089-b7e3-858a305cbfed.png" />
                                            </div>    
                                        </li>              

                                    </ul>
                              </div>

                         </div>

                           <div class="navigator-content">
                              <div class="navigator-wrapper">
                                    <ul class="navigator-wrap-inner">
                                      <li>
                                            <div>
                                            <img src="http://demo.kashmirsouq.com/images/article/5a2d74a8-5ce8-4816-895b-7235ac2b3081.png" />
                                            </div>    
                                        </li>              

                                    </ul>
                              </div>

                         </div>

          <!-- MAIN CONTENT -->
          <div class="button-next">Next</div>

          <!-- BUTTON PLAY-STOP -->
          <div class="button-control"><span></span></div>
          <!-- END OF BUTTON PLAY-STOP -->

 </div>



        </form>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

这正是我告诉你的。

您的html标记设置不正确。您已将所有图片放入自己的<div><ul>

我将您的标记修改为一个<div>和一个<ul>以及他们自己<li>中的图片

http://jsfiddle.net/Morlock0821/WGqbb/1/