加入html、css和javascript
大家好, 有一个问题,来源于这里加入html、css和javascript,javascript,html,css,inline,Javascript,Html,Css,Inline,大家好, 有一个问题,来源于这里 <div class="offer offer-blocked"> <img src="https://i.stack.imgur.com/b1oc4.jpg"></img> <div class="fb-like" data-href="http://www.windows-help-support.com" data-send="false" data-width="450" data-show-f
<div class="offer offer-blocked">
<img src="https://i.stack.imgur.com/b1oc4.jpg"></img>
<div class="fb-like" data-href="http://www.windows-help-support.com" data-send="false" data-width="450" data-show-faces="false"></div>
<div id="fb-root"></div>
.offer-blocked {
position: relative;
display: inline-block;
&:after {
content: "";
display: block;
position: absolute;
height: 100%;
width: 100%;
background-color: rgba(0,0,0,0.7);
top:0;
left:0;
}
img {
@width: 10px;
filter: blur(@width);
// Browser Specific
-webkit-filter: blur(@width);
-moz-filter: blur(@width);
-o-filter: blur(@width);
-ms-filter: blur(@width);
}
.fb-like {
z-index: 100;
position: absolute;
top: 30%;
left: 30%;
margin-left:-20px;
color: #fff;
}
.fb-like:after {
content:"Please click on the LIKE button to unlock the OFFER";
display:'block';
position: absolute;
width: 100%;
left: 0;
top: 50px;
font-size: 25px;
font-family: verdana;
}
}
jQuery( function() {
window.fbAsyncInit = function() {
// Don't use my app id, use your own or it won't work!
FB.init({appId: '134385103436857', status: true, cookie: true, xfbml: true});
FB.Event.subscribe('edge.create', function(href, widget) {
console.dir(href);
console.dir(widget);
jQuery(".offer.offer-blocked").removeClass("offer-blocked");
jQuery(".fb-like").hide();
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1& appId=134385103436857";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
``});
.报价被拒绝{
位置:相对位置;
显示:内联块;
&:之后{
内容:“;
显示:块;
位置:绝对位置;
身高:100%;
宽度:100%;
背景色:rgba(0,0,0,0.7);
排名:0;
左:0;
}
img{
@宽度:10px;
过滤器:模糊(@width);
//特定于浏览器
-webkit过滤器:模糊(@width);
-moz过滤器:模糊(@width);
-o-过滤器:模糊(@宽度);
-ms过滤器:模糊(@宽度);
}
.fb-like{
z指数:100;
位置:绝对位置;
最高:30%;
左:30%;
左边距:-20px;
颜色:#fff;
}
.之后{
内容:“请点击LIKE按钮解锁优惠”;
显示:'块';
位置:绝对位置;
宽度:100%;
左:0;
顶部:50px;
字体大小:25px;
字体系列:verdana;
}
}
jQuery(函数(){
window.fbAsyninit=函数(){
//不要使用我的应用程序id,使用你自己的,否则它将无法工作!
init({appId:'134385103436857',状态:true,cookie:true,xfbml:true});
FB.Event.subscribe('edge.create',函数(href,小部件){
console.dir(href);
console.dir(小部件);
jQuery(“.offer.offer blocked”).removeClass(“offer blocked”);
jQuery(“.fb like”).hide();
});
};
(功能(d、s、id){
var js,fjs=d.getElementsByTagName[0];
if(d.getElementById(id))返回;
js=d.createElement;js.id=id;
js.src=“//connect.facebook.net/en_US/all.js#xfbml=1&appId=134385103436857”;
fjs.parentNode.insertBefore(js,fjs);
}(文档“脚本”、“facebook jssdk”);
``});
我需要做的是把所有这些代码放到HTML中。
这将在稍后的wordpress.COM网页上公布
尝试将代码放在HTML中,放在中,并内联添加样式,但这不起作用
提前谢谢。您可以在两种情况下解决您的问题:
第一:(不推荐,但您可以这样做)
您将标签放入样式类中
并在代码js中添加以下标签
.offer-blocked {
position: relative;
display: inline-block;
&:after {
content: "";
display: block;
position: absolute;
height: 100%;
width: 100%;
background-color: rgba(0,0,0,0.7);
top:0;
left:0;
}
img {
@width: 10px;
filter: blur(@width);
// Browser Specific
-webkit-filter: blur(@width);
-moz-filter: blur(@width);
-o-filter: blur(@width);
-ms-filter: blur(@width);
}
.fb-like {
z-index: 100;
position: absolute;
top: 30%;
left: 30%;
margin-left:-20px;
color: #fff;
}
.fb-like:after {
content:"Please click on the LIKE button to unlock the OFFER";
display:'block';
position: absolute;
width: 100%;
left: 0;
top: 50px;
font-size: 25px;
font-family: verdana;
}
}
</style>
<script>
jQuery( function() {
window.fbAsyncInit = function() {
// Don't use my app id, use your own or it won't work!
FB.init({appId: '134385103436857', status: true, cookie: true, xfbml: true});
FB.Event.subscribe('edge.create', function(href, widget) {
console.dir(href);
console.dir(widget);
jQuery(".offer.offer-blocked").removeClass("offer-blocked");
jQuery(".fb-like").hide();
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1& appId=134385103436857";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
``});
</script>
<div class="offer offer-blocked">
<img src="https://i.stack.imgur.com/b1oc4.jpg"></img>
<div class="fb-like" data-href="http://www.windows-help-support.com" data-send="false" data-width="450" data-show-faces="false"></div>
<div id="fb-root"></div>
。已阻止提供{
位置:相对位置;
显示:内联块;
&:之后{
内容:“;
显示:块;
位置:绝对位置;
身高:100%;
宽度:100%;
背景色:rgba(0,0,0,0.7);
排名:0;
左:0;
}
img{
@宽度:10px;
过滤器:模糊(@width);
//特定于浏览器
-webkit过滤器:模糊(@width);
-moz过滤器:模糊(@width);
-o-过滤器:模糊(@宽度);
-ms过滤器:模糊(@宽度);
}
.fb-like{
z指数:100;
位置:绝对位置;
最高:30%;
左:30%;
左边距:-20px;
颜色:#fff;
}
.之后{
内容:“请点击LIKE按钮解锁优惠”;
显示:'块';
位置:绝对位置;
宽度:100%;
左:0;
顶部:50px;
字体大小:25px;
字体系列:verdana;
}
}
jQuery(函数(){
window.fbAsyninit=函数(){
//不要使用我的应用程序id,使用你自己的,否则它将无法工作!
init({appId:'134385103436857',状态:true,cookie:true,xfbml:true});
FB.Event.subscribe('edge.create',函数(href,小部件){
console.dir(href);
console.dir(小部件);
jQuery(“.offer.offer blocked”).removeClass(“offer blocked”);
jQuery(“.fb like”).hide();
});
};
(功能(d、s、id){
var js,fjs=d.getElementsByTagName[0];
if(d.getElementById(id))返回;
js=d.createElement;js.id=id;
js.src=“//connect.facebook.net/en_US/all.js#xfbml=1&appId=134385103436857”;
fjs.parentNode.insertBefore(js,fjs);
}(文档“脚本”、“facebook jssdk”);
``});
或者第二种解决方案是:将代码js放入新文件js并使用
添加此文件,将代码css放入新文件css并使用
添加此文件这
例如:
<body>
<head>
<link rel="stylesheet" href="link_to_css_file">
<script src="link_to_file_js"></script>
</head>
...
</body>
...
我认为您正在寻找html的基本结构,在html中可以包含
和
标记
但是你可以把样式和脚本放在单独的文件中,并在html中引用,
请参见和属性
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
/*Your style here.*/
</style>
<script type="text/javascript">
//Your script goes here
</script>
</head>
<body>
</body>
</html>
/*你的风格在这里*/
//你的剧本在这里
最好为CSS和脚本创建单独的文件,并使用以下代码行将其实现到您的网页上
CSS:
脚本:
<script type="text/javascript" src="assets/js/main.js"></script>
您是否将css放入标签,将js放入标签?你能解决你的问题吗?最好把样式和脚本放到其他文件中
<script type="text/javascript" src="assets/js/main.js"></script>