2

我刚刚开始使用 javascript。我在使用 metroui.org.ua 进行了很多搜索我无法在我的 html 中使用 .js 文件。我缺少一些配置吗?任何帮助,将不胜感激。包括我的html文件

    <head> 
<link rel="stylesheet" href="../css/modern.css" /> 
<script src="http://www.google.com/jsapi"></script>
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
 <script type="text/javascript">
      // Load jQuery
      google.load("jquery", "1");   
  </script>


<script type="text/javascript" src="../js/tile-slider.js"></script>
  </head>
 <html>
  <div class="tile image-slider" data-role="image-slider">
  <div class="tile-content">
       <img src="../img/AngryBirds.jpg"/>
  </div>

   <div class="tile-content">
       <img src="../img/CutTheRope.jpg"/>
   </div>
</div>

4

4 回答 4

1

问题可能在于对 winJS 的 Jquery 支持

请通过链接

jQuery for winjS

您使用的版本可能与 winJS 不兼容。您可能需要进行一些修改。请让我知道它是否有效。

也尝试花时间阅读这篇文章看看是否有帮助

jQuery winjs

这是我测试的代码示例。滑块工作正常。将其复制粘贴到记事本中并另存为 html。然后运行。从在线 api 它正在使用代码。

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1.0, maximum-scale=1">
    <meta name="description" content="Modern UI CSS">
    <meta name="author" content="Sergey Pimenov">
    <meta name="keywords" content="windows 8, modern style, modern ui, style, modern, css, framework">

    <link href="http://metroui.org.ua/css/modern.css" rel="stylesheet">
    <link href="http://metroui.org.ua/css/theme-dark.css" rel="stylesheet">
    <link href="http://metroui.org.ua/css/modern-responsive.css" rel="stylesheet">

    <script src="http://metroui.org.ua/js/assets/jquery-1.8.2.min.js"></script>
    <script src="http://metroui.org.ua/js/assets/google-analytics.js"></script>
    <script src="http://metroui.org.ua/js/assets/jquery.mousewheel.min.js"></script>
    <script src="http://metroui.org.ua/js/assets/github.info.js"></script>
    <script src="http://metroui.org.ua/js/modern/tile-slider.js"></script>
    <script src="http://metroui.org.ua/js/modern/start-menu.js"></script>
    <script src="http://metroui.org.ua/js/modern/tile-drag.js"></script>

    <title>Modern UI CSS</title>

    <style>
        body {
            background: #1d1d1d;
        }
    </style>

</head>
<body class="metrouicss">
<div class="page secondary fixed-header">
    <div class="page-header ">
        <div class="page-header-content">
            <div class="user-login">
                <a href="http://metroui.org.ua/#">
                    <div class="name">
                        <span class="first-name">Sergey</span>
                        <span class="last-name">Pimenov</span>
                    </div>
                    <div class="avatar">
                        <!--<img src="http://metroui.org.ua/images/myface.jpg"/>-->
                        <i class="icon-user fg-color-white"></i>
                    </div>
                </a>
            </div>

            <h1 class="fg-color-white">Start</h1>
        </div>
    </div>

    <div class="page-region">
        <div class="page-region-content tiles">
            <div class="tile-group tile-drag">
                <div class="tile icon">
                    <div class="tile-content">
                        <i class="icon-calculate"></i>
                    </div>
                    <div class="brand">
                        <span class="name">Calculator</span>
                    </div>
                </div>



                <a target="_blank" id="qq" href="http://metroui.org.ua//" onclick="console.log('clicked')" class="tile image outline-color-green">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/myface.jpg" alt="">
                    </div>
                </a>

                <div class="tile icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/Mail128.png"/>
                    </div>
                    <div class="brand">
                        <div class="badge">10</div>
                        <div class="name">Mail</div>
                    </div>
                </div>

                <div class="tile bg-color-orangeDark icon">
                    <b class="check"></b>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/Video128.png" alt="" />
                    </div>
                    <div class="brand">
                        <span class="name">Video</span>
                    </div>
                </div>

                <div class="tile double image">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/5.jpg" alt="" />
                    </div>
                    <div class="brand">
                        <span class="name">Pictures</span>
                        <div class="badge bg-color-orange">5</div>
                    </div>
                </div>

                <div class="tile bg-color-green icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/Market128.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">Store</span>
                        <span class="badge">6</span>
                    </div>
                </div>

                <div class="tile bg-color-red icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/Music128.png" alt="" />
                    </div>
                    <div class="brand">
                        <span class="name">Music</span>
                    </div>
                </div>

                <div class="tile double bg-color-blueDark">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/michael.jpg" class="place-left"/>
                        <h3 style="margin-bottom: 5px;">michael_angiulo</h3>
                        <p>
                            I just saw Thor last night. It was awesome! I think you'd love it.
                        </p>
                        <h5>RT @julie_green</h5>

                    </div>
                    <div class="brand">
                        <span class="name">Tweet@rama</span>
                    </div>
                </div>

                <div class="tile bg-color-darken icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/YouTube128.png" alt="" />
                    </div>
                    <div class="brand">
                        <span class="name">YouTube</span>
                    </div>
                </div>

                <div class="tile double bg-color-green" data-role="tile-slider" data-param-period="3000">
                    <div class="tile-content">
                        <h2>mattberg@live.com</h2>
                        <h5>Re: Wedding Annoucement!</h5>
                        <p>
                            Congratulations! I'm really excited to celebrate with you all. Thanks for...
                        </p>
                    </div>
                    <div class="tile-content">
                        <h2>tina@live.com</h2>
                        <h5>Re: Wedding Annoucement!</h5>
                        <p>
                            Huh! Waw!!! I'm really excited to celebrate with you all. Thanks for...
                        </p>
                    </div>
                    <div class="brand">
                        <div class="badge">12</div>
                        <img class="icon" src="http://metroui.org.ua/images/Mail128.png"/>
                    </div>
                </div>
                <div class="tile double image-slider" data-role="tile-slider" data-param-period="5000" data-param-direction="left">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/1.jpg" alt="">
                    </div>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/2.jpg" alt="">
                    </div>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/3.jpg" alt="">
                    </div>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/4.jpg" alt="">
                    </div>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/5.jpg" alt="">
                    </div>
                </div>

            </div>

            <div class="tile-group tile-drag">
                <div class="tile image outline-color-green">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/myface.jpg" alt="">
                    </div>
                </div>
            </div>

            <div class="tile-group tile-drag">
                <div class="tile bg-color-blue icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/InternetExplorer128.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">Internet Explorer</span>
                    </div>
                </div>

                <div class="tile icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/excel2013icon.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">Excel 2013</span>
                    </div>
                </div>

                <div class="tile icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/word2013icon.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">Word 2013</span>
                    </div>
                </div>

                <div class="tile icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/onenote2013icon.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">OneNote 2013</span>
                    </div>
                </div>
                <div class="tile double image-set">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/1.jpg" alt="">
                    </div>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/2.jpg" alt="">
                    </div>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/3.jpg" alt="">
                    </div>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/4.jpg" alt="">
                    </div>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/5.jpg" alt="">
                    </div>
                    <div class="brand">
                        <span class="name">Photos</span>
                    </div>
                </div>
            </div>

            <div class="tile-group">
                <div class="tile double image">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/4.jpg" alt="" />
                    </div>
                    <div class="brand bg-color-orange">
                        <img class="icon" src="http://metroui.org.ua/images/Rss128.png"/>
                        <p class="text">This is a desert eagle. He is very hungry and angry bird.</p>
                        <div class="badge">10</div>
                    </div>
                </div>

                <div class="tile bg-color-blue icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/InternetExplorer128.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">Internet Explorer</span>
                    </div>
                </div>

                <div class="tile icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/excel2013icon.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">Excel 2013</span>
                    </div>
                </div>

                <div class="tile icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/word2013icon.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">Word 2013</span>
                    </div>
                </div>

                <div class="tile icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/onenote2013icon.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">OneNote 2013</span>
                    </div>
                </div>
            </div>

            <div class="tile-group tile-drag">
                <div class="tile double image">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/4.jpg" alt="" />
                    </div>
                    <div class="brand bg-color-orange">
                        <img class="icon" src="http://metroui.org.ua/images/Rss128.png"/>
                        <p class="text">This is a desert eagle. He is very hungry and angry bird.</p>
                        <div class="badge">10</div>
                    </div>
                </div>

                <div class="tile bg-color-blue icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/InternetExplorer128.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">Internet Explorer</span>
                    </div>
                </div>

                <div class="tile icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/excel2013icon.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">Excel 2013</span>
                    </div>
                </div>

                <div class="tile icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/word2013icon.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">Word 2013</span>
                    </div>
                </div>

                <div class="tile icon">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/onenote2013icon.png"/>
                    </div>
                    <div class="brand">
                        <span class="name">OneNote 2013</span>
                    </div>
                </div>
            </div>

            <div class="tile-group">
                <div class="tile quadro double-vertical image-set">
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/1.jpg" alt="">
                    </div>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/2.jpg" alt="">
                    </div>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/3.jpg" alt="">
                    </div>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/4.jpg" alt="">
                    </div>
                    <div class="tile-content">
                        <img src="http://metroui.org.ua/images/5.jpg" alt="">
                    </div>
                    <div class="brand">
                        <span class="name">Photos</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<a href='http://hit.ua/?x=19154' target='_blank'>
    <script language="javascript" type="text/javascript"><!--
    Cd=document;Cr="&"+Math.random();Cp="&s=1";
    Cd.cookie="b=b";if(Cd.cookie)Cp+="&c=1";
    Cp+="&t="+(new Date()).getTimezoneOffset();
    if(self!=top)Cp+="&f=1";
    //--></script>
    <script language="javascript1.1" type="text/javascript"><!--
    if(navigator.javaEnabled())Cp+="&j=1";
    //--></script>
    <script language="javascript1.2" type="text/javascript"><!--
    if(typeof(screen)!='undefined')Cp+="&w="+screen.width+"&h="+
            screen.height+"&d="+(screen.colorDepth?screen.colorDepth:screen.pixelDepth);
    //--></script>
    <script language="javascript" type="text/javascript"><!--
    Cd.write("<img src='http://c.hit.ua/hit?i=19154&g=0&x=2"+Cp+Cr+
            "&r="+escape(Cd.referrer)+"&u="+escape(window.location.href)+
            "' border='0' wi"+"dth='1' he"+"ight='1'/>");
    //--></script>
    <noscript>
        <img src='http://c.hit.ua/hit?i=19154&amp;g=0&amp;x=2' border='0'/>
    </noscript></a>
<!-- / hit.ua -->

</body>
</html>
于 2013-09-09T06:34:53.380 回答
0

如果您只想显示翻转图块,则可以使用 jqueryanimate函数,如下所示:

// hides the given tile, and calls the callback.
this._hideTile = function(tile, callback){
    tile.animate({height:0});
}

// shows the given tile.
this._showTile= function(tile){
    tile.animate({height:150});
}

查看此 jsFiddle中的完整逻辑。

于 2014-05-10T14:17:28.553 回答
0

您的 html 标记位于错误的位置 - 它应该如下所示:

<!DOCTYPE html>
<html>
    <head>
        <!-- script and link tags go here -->
    </head>
    <body>
        <!-- div and img tags go here -->
    </body>
</html>
于 2013-09-04T08:56:31.017 回答
0

这个问题根本不清楚。如果我理解正确,您的问题可能是该行:

<script type="text/javascript" src="../js/tile-slider.js"></script>

在头标签中。尝试将其移动到正文标签末尾的后面。尝试将每个不起作用的脚本移到那里。如果脚本位于错误的位置,则 javascript 中的某些内容将不起作用 - 这是因为如果脚本位于开头,则会在读取 html 之前读取它。例如,如果您尝试更改 html 中的某些内容,如果它位于该 html 行之前,它将不会这样做。如果它不起作用,请添加脚本源。

于 2013-09-04T08:15:00.527 回答