2017-06-19 24 views
-2

良い一日をみんなに参加し、は、HTML、CSSおよびJavaScript

は、ここからソースを一つの問題を持って、私がする必要がどのような

<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')); 

``}); 

は、HTMLの中に一緒にすべてこのコードを入れています。 これは後でwordpress.COMのウェブページに掲載されます。

HTMLの内部にコードを挿入して、スタイルをインラインで追加しようとしましたが、これは機能しませんでした。

ありがとうございます。

+0

あなたはタグとJSにあなたのCSSを入れていましたか?あなたの問題を発展させることができますか? –

+0

スタイルやスクリプトを他のファイルに置く方がよい – KrisKK

答えて

1

私は、HTMLの基本構造を探している、HTMLの中にあなたが<style><script>タグを含めることができると思います。

しかし、スタイルとスクリプトを別々のファイルに入れて、htmlで参照することができます。 scriptstyleの属性を参照してください。

<!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> 
1

次の2つのケースであなたの問題を解決することができます:
最初:(推奨されませんが、あなたはこれを行うことができます)
あなたがタグあなたのスタイルクラスに入れ

あなたのコードの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> 

または第二の解決策は次のとおりです。
は、新しいファイルのjsにあなたのコードのJSを入れて<script src="link_to_file_js"></script>を使用してこのファイルを追加し、NEにあなたのコードのCSSを置きますw file cssを入力し、<link rel="stylesheet" href="link_to_css_file">を使用してこのファイルを追加します。
この
examlpeの場合:

<body> 
    <head> 
     <link rel="stylesheet" href="link_to_css_file"> 
     <script src="link_to_file_js"></script> 
    </head> 
    ... 
</body> 
0

CSSとスクリプト用に別々のファイルを作成し、次のコード行を使用してWebページに実装する方がよい場合があります。

CSS:

<head> 
    <link rel="stylesheet" src="assets/css/main.css" type="text/css" /> 
</head> 

スクリプト:

<script type="text/javascript" src="assets/js/main.js"></script> 
関連する問題