简体   繁体   English

我有一个JSFiddle,其中包括HTML,JavaScript和CSS。 有没有简单的方法可以将其实现到Dreamweaver页面中?

[英]I have a JSFiddle that includes HTML, JavaScript, and CSS. Is there a simple way to implement it into a Dreamweaver page?

I have looked practically everywhere online and have done quite a bit of experimenting of my own, but can't seem to get the same result in Dreamweaver that is present in the JSFiddle result . 我几乎在网上到处都看过,并且做了很多自己的实验,但是在Dreamweaver中似乎无法获得JSFiddle结果中的结果

Is there a relatively simple way to make a webpage of a site that is identical to the JSFiddle result (and how is it possible to do that)? 是否有一种相对简单的方法来制作与JSFiddle结果相同的网站网页(以及如何做到这一点)?

I think your problem is that jsFiddle hides certain things that are required in order for the code to work, most importantly in this case is the reference to jquery, jsfiddle will put that in for you behind the scenes but if you take your code out of jsfiddle and don't reference jquery as I have then the code is useless. 我认为您的问题是jsFiddle隐藏了使代码正常工作所需的某些内容,最重要的是,在这种情况下,是对jquery的引用,jsfiddle会在后台为您提供这些信息,但是如果您将代码从中取出jsfiddle并且不引用jquery,因为我的代码没有用。 Also things like <style> tags around your css, although not need in jsfiddle, are needed when pasting the code into something like dreamweaver. 当将代码粘贴到Dreamweaver之类的代码中时,css周围也不需要诸如<style>标记之类的东西,尽管在jsfiddle中不需要。

<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <style>
            body {
                margin: 0;
                padding: 0;
            }
            #turtle img {
                display: block;
                margin: 0 auto;
            }
        </style>
        <script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
        <script>
            $(function () {
                var img = $('#turtle').html();
                for (var i = 0; i < 10; i++) {
                    more(img);
                }
                $(window).on('scroll', function () {
                    if ($(this).scrollTop() >= $('#turtle').height() - $(this).height()) {
                        more(img);
                    }
                });

                function more(content) {
                    $('#turtle').append(content);
                }
            });
        </script>
    </head>
    <body>
        <div id="turtle">
            <img src="http://upload.wikimedia.org/wikipedia/en/9/9b/Rickastleyposter.jpg" alt="infinity-turtle" />
        </div>
    </body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试使用 Dreamweaver 在 html 页面上实现 javascript,(鼠标跟踪器) - Attempting to implement javascript on html page using Dreamweaver, (mouse tracker) JSFiddle JavaScript在Dreamweaver中不起作用 - JSFiddle JavaScript not working in Dreamweaver 如何使用Dreamweaver使用javascript在HTML中实现文本中断 - How to implement a break in text in html with javascript with dreamweaver jQuery + CSS。 将样式实现到众多元素的最快方法 - jQuery + CSS. The fastest way to implement the style to numerous elements 我在CSS中设置HTML元素的display属性。 但是,如果我在javascript中检查该值,则显示为空白 - I set the display property of an HTML element in CSS. But, if I check that value in javascript it shows blank 使用 html 和 css 在 Javascript 增加按钮。 我有点困惑 - Increment Button at Javascript using html and css. I am bit confused 使用html和CSS的PDF Type视图。 页面溢出问题 - PDF Type view using html and css. Page overflow problem 如何在 HTML CSS 中使我的滚动始终位于页面的末尾。 我希望我的卷轴总是在页面的末尾 - How do I make my scroll always in the end of the page in HTML CSS. I want my scroll to always be at the end of the page 如何在CSS中获取页面宽度。 - How do I get the page width in a css. 我们如何在简单的 HTML 页面中使用 Javascript 实现分页 - How can we implement Pagination using Javascript in simple HTML page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM