• About
  • Policy
  • Contact

Phan Anh Buổi Sáng

  • Home
  • Kiến thức IT
    • PSD
    • Blogger
  • Translate
Google
Custom Search
Trang chủ » Blogger » [ Blogger ] Hướng Dẫn Thêm Button Vào Blogspot

[ Blogger ] Hướng Dẫn Thêm Button Vào Blogspot

Unknown Labels: Blogger Leave A Comment 00:54

Bước 1 : Đầu tiên, bạn cần thêm thư viện jQuery vào blog bằng cách thêm đoạn sau vào phía dưới thẻ<head>
1
<script src='http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js'/>
Nếu bạn nào đã từng thêm thư viện jQuery vào blog rồi thì có thể bỏ qua bước này
Bước 2 : Tiếp theo, hãy thêm đoạn code dưới đây vào phía trên thẻ đóng </body>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<script type='text/javascript'>
  //<![CDATA[
  /* Facebook */
  (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";
       fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
  window.fbAsyncInit = function() {
      // init the FB JS SDK
      FB.init({
        status     : true,                            
        xfbml      : true                              
      });
      FB.Event.subscribe('edge.create', function(href, widget) {
          $.event.trigger({
              type: "pageShared",
              url: href
          });
      });
  };
  /* Twitter */
    window.twttr = (function (d,s,id) {
    var t, js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return; js=d.createElement(s); js.id=id;
    js.src="https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs);
    return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } });
  }(document, "script", "twitter-wjs"));
  twttr.ready(function (twttr) {
      twttr.events.bind('tweet', function (event) {
          $.event.trigger({
              type: "pageShared",
              url: event.target.baseURI
          });
      });
  });
  /* Google Plus */
  (function() {
      var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
      po.src = 'https://apis.google.com/js/plusone.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
    })();
  function plusOned(obj){
      console.log(obj);
      $.event.trigger({
          type: "pageShared",
          url: obj.href
      });
  }
  /* Listen for the pageShared event */
  $(document).on('pageShared',function(e){
      if(e.url == window.location.href){
          $(".hide").show();
          $(".show").hide();
      }
  });
  //]]>
</script>
Bước 3 : Thêm đoạn code dưới đây vào phía trên thẻ  ]]></b:skin>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
.hide {
  display: none;
  background: #f9f9f9;
  color: #111;
  border-radius: 5px;
  border-bottom: 4px solid #f1f1f1;
  padding: 20px;
}
.show {
  padding: 20px;
  background: #f9f9f9;
  color: #111;
  border-radius: 5px;
  border-bottom: 4px solid #f1f1f1;
  text-align: center;
 
}
.show .fb-like {
  margin-top: 0;
  top: -7px;
  position: relative;
}
.show .twitter-share-button {
  margin-right: 25px;
}

Làm sao để sử dụng ?

Để thêm button “Like to Unlock” vào bài viết, đầu tiên hãy chuyển sang chế độ soạn thảo HTML
1
Tiếp đó, điền đoạn code dưới đây vào vị trí muốn sử dụng
1
2
3
4
5
6
7
<div class="hide">
..........
</div>
<div class="show">
To unlock the content, use one of the social buttons below. Thank you for your support and love.
<span class="fb-like" data-layout="button_count" data-send="false" data-show-faces="false" data-width="90" expr:data-href="data:post.url" style="margin-right: 25px;"></span><a class="twitter-share-button" data-count="horizontal" data-related="" data-via="doiguocmoc"
    expr:data-text="data:post.title" expr:data-url="data:post.url" href="http://twitter.com/share">Tweet</a><span class="g-plusone" data-callback="plusOned" data-count="true" data-size="medium" expr:data-href="data:post.url"></span></div>
trong đó : …….. là phần nội dung sẽ bị ẩn đi
Cuối cùng, hãy xuất bản bài viết. Bây giờ, để xem phần nội dung bị ẩn đi, người dùng sẽ buộc phải like, twitter, +1 bài viết của bạn.
Chúc các bạn thành công

Bài viết liên quan

← Bài đăng mới hơn Bài đăng cũ hơn → Trang chủ
Powered by Blogger.

Các Bình Luận Gần Đây

Bài đăng phổ biến

  • PSD - Người & Ta
    DOWNLOAD PSD
  • Ảnh bìa chế Phía sau một cô gái - Soobin Hoàng Sơn - Zoy Thủ Thuật #Zoy
    Đôi lúc em tránh ánh mắt của anh. vì dường như lúc nào em cũng hiểu thấu lòng anh Demo Cover Download PSD loading...
  • Share CMND Nữ Cho Anh Em Để Unlock & Report
    COPYRIGHT : MINH HAKU IT                                               
  • [PHP] Get list username - vBulletin
    <?php // GET user function duyk_get_all_usr($link, $total_usr) { $max_page = $total_usr/100; $ma...
  • Thêm Twitter Fan Box vào Blogger/ web của bạn
    Hướng dẫn tạo Twitter Fan Box cho blogger, Twitter cung cấp khá nhiểu công cụ để chia sẻ bài viết của bạn lên trang Twitter cá nhân và ngược...
  • PSD - Xin Hãy Rời Xa
    Download PSD
  • Resize Blogger Popular Post thumbnails
    Thay đổi kích thước hình thu nhỏ bài đăng phổ biến cho Blogger /blogspot. Làm thế nào để thay đổi kích thước hình nhỏ trong Blogger bài tiệ...
  • PSD - Ảnh bìa Ông Bà Anh P.3
    Nguồn: Kid Shadow LIÊN HỆ                  DOWNLOAD
  • CodeXploiter 1.0 - Tìm kiếm các lỗ hổng trong các file PHP
    CodeXploiter is a White-Box scanner used for finding vulnerabilities in PHP files. It scans PHP source code files automatically based on ...
  • Invision IP.Board <= 3.3.4 unserialize() PHP Code Execution
    ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasp...

Pageviews from the past week

Chuyên mục

Bài đăng phổ biến

  • PSD - Người & Ta
    PSD - Người & Ta
    DOWNLOAD PSD
  • Ảnh bìa chế Phía sau một cô gái - Soobin Hoàng Sơn - Zoy Thủ Thuật #Zoy
    Ảnh bìa chế Phía sau một cô gái - Soobin Hoàng Sơn - Zoy Thủ Thuật #Zoy
    Đôi lúc em tránh ánh mắt của anh. vì dường như lúc nào em cũng hiểu thấu lòng anh Demo Cover Download PSD loading...
  • Share CMND Nữ Cho Anh Em Để Unlock & Report
    Share CMND Nữ Cho Anh Em Để Unlock & Report
    COPYRIGHT : MINH HAKU IT                                               
  • [PHP] Get list username - vBulletin
    <?php // GET user function duyk_get_all_usr($link, $total_usr) { $max_page = $total_usr/100; $ma...
  • Thêm Twitter Fan Box vào Blogger/ web của bạn
    Thêm Twitter Fan Box vào Blogger/ web của bạn
    Hướng dẫn tạo Twitter Fan Box cho blogger, Twitter cung cấp khá nhiểu công cụ để chia sẻ bài viết của bạn lên trang Twitter cá nhân và ngược...
  • PSD - Xin Hãy Rời Xa
    PSD - Xin Hãy Rời Xa
    Download PSD
  • Resize Blogger Popular Post thumbnails
    Resize Blogger Popular Post thumbnails
    Thay đổi kích thước hình thu nhỏ bài đăng phổ biến cho Blogger /blogspot. Làm thế nào để thay đổi kích thước hình nhỏ trong Blogger bài tiệ...
  • PSD - Ảnh bìa Ông Bà Anh P.3
    PSD - Ảnh bìa Ông Bà Anh P.3
    Nguồn: Kid Shadow LIÊN HỆ                  DOWNLOAD
  • CodeXploiter 1.0 - Tìm kiếm các lỗ hổng trong các file PHP
    CodeXploiter 1.0 - Tìm kiếm các lỗ hổng trong các file PHP
    CodeXploiter is a White-Box scanner used for finding vulnerabilities in PHP files. It scans PHP source code files automatically based on ...
  • Invision IP.Board <= 3.3.4 unserialize() PHP Code Execution
    ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasp...
Google
Custom Search
Support: Facebook | Twitter | Google+ | Giới thiệu
Copyright © 2015 • Phan Anh Buổi Sáng • All Right Reserved. Template by Template Việt