[英]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.