Tutorial Blogspot

Tutorial Blogspot, SEO, HTML5, CSS3, Facebook, Twitter, Software, Game, Motivasi, Tips dan Trik

Select Menu
  • Home
  • Blogging
    • Tutorial Blogspot
    • CSS
    • jQuery
    • Widget
  • Tools
    • SEO
    • Template Blogger
    • HTML Encrypter
    • Code Color
    • Responsive Cek
  • Sitemap
  • About Me
  • Link Exchange
  • Pasang Iklan
  • Kontes SEO Template Premium
Home » jQuery » Responsive Jquery Modal Box

Sabtu, 13 September 2014

Responsive Jquery Modal Box

Unknown
Add Comment
jQuery
Sabtu, 13 September 2014
Dialox box jika diartikan dalam bahasa indonesia berarti kotak dialog. Teknik ini merupakan salah satu teknik dari JQuery UI yang sering sekali digunakan dalam pembuatan website. Dialox Box dapat digunakan untuk bermacam-macam hal, sesuai kebutuhan yang ada pada website. Misalnya untuk menampilkan iklan ketika tombol diklik, menampilkan pesan atau informasi penting pada website ketika tombol dklik, bahkan dapat digunakan untuk pengisian formulir pendaftaran atau komentar ketika tombol dklik. Selain tampilannya menarik, teknik ini juga dapat bermanfaat untuk menghemat ruang pada website.

Responsive Jquery Modal Box



Langkah pertama

  • Login Ke Blogger.com pakai akun sobat.
  • Edit template. (Backup dulu apabila terjadi kesalahan)
  • Cari tag ]]></b:skin> atau </style> gunakan CTRL + F untuk mempermudah pencarian kemudian sisipkan CSS berikut ini..
  1. html.remodal_lock, body.remodal_lock {
  2. overflow : hidden;
  3. }
  4. .remodal, [data-remodal-id] {
  5. visibility : hidden;
  6. }
  7. .remodal-overlay {
  8. position : fixed;
  9. top : 0;
  10. left : 0;
  11. right : 0;
  12. bottom : 0;
  13. z-index : 10000;
  14. display : none;
  15. overflow : auto;
  16. text-align : center;
  17. }
  18. .remodal-overlay:after {
  19. display : inline-block;
  20. height : 100%;
  21. margin-left : -0.05em;
  22. content : '';
  23. }
  24. .remodal {
  25. position : relative;
  26. display : inline-block;
  27. }
  28. .remodal-bg {
  29. transition : filter 0.2s linear;
  30. }
  31. .remodal-overlay {
  32. opacity : 0;
  33. background : rgba(33, 36, 46, 0.95);
  34. transition : opacity 0.2s linear;
  35. }
  36. body.remodal_active .remodal-overlay {
  37. opacity : 1;
  38. }
  39. .remodal {
  40. width : 100%;
  41. min-height : 100%;
  42. padding : 35px;
  43. box-sizing : border-box;
  44. font-size : 16px;
  45. background : #f4f4f4;
  46. background-clip : padding-box;
  47. color : #182a3c;
  48. box-shadow : 0 0 8px #171a24;
  49. transform : scale(0.95);
  50. transition : transform 0.2s linear;
  51. }
  52. body.remodal_active .remodal {
  53. transform : scale(1);
  54. }
  55. .remodal, .remodal-overlay:after {
  56. vertical-align : middle;
  57. }
  58. .remodal-close {
  59. position : absolute;
  60. top : 5px;
  61. left : 5px;
  62. width : 28px;
  63. height : 28px;
  64. text-decoration : none;
  65. border-radius : 50%;
  66. border : #3e5368 solid 2px;
  67. transition : background 0.2s linear;
  68. }
  69. .remodal-close:after {
  70. display : block;
  71. font-size : 28px;
  72. font-family : Arial, 'Helvetica CY', 'Nimbus Sans L', sans-serif !important ;
  73. content : "X";
  74. line-height : 28px;
  75. cursor : pointer;
  76. text-decoration : none;
  77. color : #3e5368;
  78. transition : all 0.2s linear;
  79. }
  80. .remodal-close:hover, .remodal-close:active {
  81. background : #3e5368;
  82. }
  83. .remodal-close:hover.remodal-close:after, .remodal-close:active.remodal-close:after {
  84. color : #f4f4f4;
  85. }
  86. .remodal-confirm, .remodal-cancel {
  87. display : inline-block;
  88. width : 120px;
  89. padding : 9px 0;
  90. margin : 0 0 5px 0;
  91. font-size : 10pt;
  92. cursor : pointer;
  93. text-decoration : none;
  94. text-align : center;
  95. border-radius : 50px;
  96. background-clip : padding-box;
  97. transition : all 0.2s linear;
  98. }
  99. .remodal-confirm {
  100. border : #16a085 solid 2px;
  101. background : #f4f4f4;
  102. color : #16a085;
  103. }
  104. .remodal-confirm:hover, .remodal-confirm:active {
  105. background : #16a085;
  106. color : #f4f4f4;
  107. }
  108. .remodal-cancel {
  109. border : #c0392b solid 2px;
  110. background : #f4f4f4;
  111. color : #c0392b;
  112. }
  113. .remodal-cancel:hover, .remodal-cancel:active {
  114. background : #c0392b;
  115. color : #f4f4f4;
  116. }
  117. @media only screen and (min-width:40.063em) {
  118. .remodal {
  119. max-width : 700px;
  120. margin : 20px auto;
  121. min-height : 0;
  122. border-radius : 6px;
  123. }
  124. }
  125. .show_button {
  126. font-family : 'Lobster', cursive;
  127. font-size : 48px;
  128. display : inline-block;
  129. width : 150px;
  130. height : 150px;
  131. text-align : center;
  132. text-decoration : none;
  133. line-height : 142px;
  134. color : #ecf0f1;
  135. border-radius : 50%;
  136. background : #c0392b;
  137. transition : background 0.3s ease-out;
  138. }
  139. .show_button:hover, .show_button:active {
  140. background : #e74c3c;
  141. }

Langkah Kedua

  • Cari tag </body> gunakan CTRL + F untuk mempermudah pencarian kemudian tambahkan Javascript berikut ini..
  1. <script type='text/javascript'>
  2. ! function(a) {
  3. "use strict";
  4.  
  5. function b(b, e) {
  6. this.settings = a.extend({}, d, e), this.modal = b, this.buildDOM(), this.addEventListeners(), this.index = a[c].lookup.push(this) - 1, this.busy = !1
  7. }
  8. var c = "remodal",
  9. d = {
  10. hashTracking: !0,
  11. closeOnConfirm: !0,
  12. closeOnCancel: !0
  13. };
  14. a[c] = {
  15. lookup: []
  16. };
  17. var e, f, g = function(a) {
  18. var b = a.css("transition-duration") || a.css("-webkit-transition-duration") || a.css("-moz-transition-duration") || a.css("-o-transition-duration") || a.css("-ms-transition-duration") || 0,
  19. c = a.css("transition-delay") || a.css("-webkit-transition-delay") || a.css("-moz-transition-delay") || a.css("-o-transition-delay") || a.css("-ms-transition-delay") || 0;
  20. return 1e3 * (parseFloat(b) + parseFloat(c))
  21. },
  22. h = function() {
  23. if (a(document.body).height() <= a(window).height()) return 0;
  24. var b = document.createElement("div");
  25. b.style.visibility = "hidden", b.style.width = "100px", document.body.appendChild(b);
  26. var c = b.offsetWidth;
  27. b.style.overflow = "scroll";
  28. var d = document.createElement("div");
  29. d.style.width = "100%", b.appendChild(d);
  30. var e = d.offsetWidth;
  31. return b.parentNode.removeChild(b), c - e
  32. },
  33. i = function() {
  34. a(document.body).css("padding-right", "+=" + h()), a("html, body").addClass(c + "_lock")
  35. },
  36. j = function() {
  37. a(document.body).css("padding-right", "-=" + h()), a("html, body").removeClass(c + "_lock")
  38. },
  39. k = function(a) {
  40. var b, c, d = {};
  41. b = a.replace(/\s*:\s*/g, ":").replace(/\s*,\s*/g, ","), c = b.split(",");
  42. var e, f, g;
  43. for (e = 0, f = c.length; f > e; e++) c[e] = c[e].split(":"), g = c[e][1], ("string" == typeof g || g instanceof String) && (g = "true" === g || ("false" === g ? !1 : g)), ("string" == typeof g || g instanceof String) && (g = isNaN(g) ? g : +g), d[c[e][0]] = g;
  44. return d
  45. };
  46. b.prototype.buildDOM = function() {
  47. this.body = a(document.body), this.bg = a("." + c + "-bg"), this.modalClose = a("<a href='#'>").addClass(c + "-close"), this.overlay = a("<div>").addClass(c + "-overlay"), this.modal.hasClass(c) || this.modal.addClass(c), this.modal.css("visibility", "visible"), this.modal.append(this.modalClose), this.overlay.append(this.modal), this.body.append(this.overlay), this.confirm = this.modal.find("." + c + "-confirm"), this.cancel = this.modal.find("." + c + "-cancel");
  48. var b = g(this.overlay),
  49. d = g(this.modal),
  50. e = g(this.bg);
  51. this.td = d > b ? d : b, this.td = e > this.td ? e : this.td
  52. }, b.prototype.addEventListeners = function() {
  53. var b = this;
  54. this.modalClose.bind("click." + c, function(a) {
  55. a.preventDefault(), b.close()
  56. }), this.cancel.bind("click." + c, function(a) {
  57. a.preventDefault(), b.modal.trigger("cancel"), b.settings.closeOnCancel && b.close()
  58. }), this.confirm.bind("click." + c, function(a) {
  59. a.preventDefault(), b.modal.trigger("confirm"), b.settings.closeOnConfirm && b.close()
  60. }), a(document).bind("keyup." + c, function(a) {
  61. 27 === a.keyCode && b.close()
  62. }), this.overlay.bind("click." + c, function(d) {
  63. var e = a(d.target);
  64. e.hasClass(c + "-overlay") && b.close()
  65. })
  66. }, b.prototype.open = function() {
  67. if (!this.busy) {
  68. this.busy = !0, this.modal.trigger("open");
  69. var b = this.modal.attr("data-" + c + "-id");
  70. b && this.settings.hashTracking && (f = a(window).scrollTop(), location.hash = b), e && e !== this && (e.overlay.hide(), e.body.removeClass(c + "_active")), e = this, i(), this.overlay.show();
  71. var d = this;
  72. setTimeout(function() {
  73. d.body.addClass(c + "_active"), setTimeout(function() {
  74. d.busy = !1, d.modal.trigger("opened")
  75. }, d.td + 50)
  76. }, 25)
  77. }
  78. }, b.prototype.close = function() {
  79. if (!this.busy) {
  80. this.busy = !0, this.modal.trigger("close"), this.settings.hashTracking && this.modal.attr("data-" + c + "-id") === location.hash.substr(1) && (location.hash = "", a(window).scrollTop(f)), this.body.removeClass(c + "_active");
  81. var b = this;
  82. setTimeout(function() {
  83. b.overlay.hide(), j(), b.busy = !1, b.modal.trigger("closed")
  84. }, b.td + 50)
  85. }
  86. }, a && (a.fn[c] = function(d) {
  87. var e;
  88. return this.each(function(f, g) {
  89. var h = a(g);
  90. null == h.data(c) && (e = new b(h, d), h.data(c, e.index), e.settings.hashTracking && h.attr("data-" + c + "-id") === location.hash.substr(1) && e.open())
  91. }), e
  92. }), a(document).ready(function() {
  93. a(document).on("click", "[data-" + c + "-target]", function(b) {
  94. b.preventDefault();
  95. var d = b.currentTarget,
  96. e = d.getAttribute("data-" + c + "-target"),
  97. f = a("[data-" + c + "-id=" + e + "]");
  98. a[c].lookup[f.data(c)].open()
  99. }), a(document).find("." + c).each(function(b, d) {
  100. var e = a(d),
  101. f = e.data(c + "-options");
  102. f ? ("string" == typeof f || f instanceof String) && (f = k(f)) : f = {}, e[c](f)
  103. })
  104. });
  105. var l = function(b, d) {
  106. var f = location.hash.replace("#", "");
  107. if ("undefined" == typeof d && (d = !0), f) {
  108. var g;
  109. try {
  110. g = a("[data-" + c + "-id=" + f.replace(new RegExp("/", "g"), "\\/") + "]")
  111. } catch (b) {}
  112. if (g && g.length) {
  113. var h = a[c].lookup[g.data(c)];
  114. h && h.settings.hashTracking && h.open()
  115. }
  116. } else d && e && !e.busy && e.settings.hashTracking && e.close()
  117. };
  118. a(window).bind("hashchange." + c, l)
  119. }(window.jQuery || window.Zepto);
  120. </script>
  • Save template, jika terjadi error silahkan konversikan dulu Javascript di atas melalui Formulir Konversi Kode di atas Form Komentar Blog ini

Langkah Terkahir

Setelah berhasil "Save template" silahkan sobat pergi ke Tata letak blogger sobat, Add Gadget - Javascript/HTML kemudian tambahkan tag HTML di bawah ini..
  1. <a class="show_button" href="#show">Show</a>
  2.  
  3. <div class="remodal" data-remodal-id="show">
  4. <h3>Demo Modal</h3>
  5. <p>
  6. Flat, responsive, lightweight, fast, easy customizable modal window jquery plugin
  7. with declarative state notation and hash tracking.
  8. </p>
  9. <a class="remodal-confirm" href="#">OK</a>
  10. </div>

Semoga bermanfaat..
Suka Artikel? Bagikan: Facebook Twitter Google+

0 Comments

Berkomentarlah Dengan Sopan

Posting Lebih Baru Posting Lama Beranda
Langganan: Posting Komentar (Atom)

Statistik

Flag Counter

Label

  • Blogging
  • Css
  • jQuery
  • SEO
  • Template
  • Widget
Diberdayakan oleh Blogger.

Arsip Blog

  • ▼  2014 (41)
    • ▼  September (33)
      • Download Software Untuk Membuat Logo
      • Mengenal Google Sandbox dan Solusinya
      • Learning From Lost Link Opportunities
      • Cara Membuat Label Cloud Flat Keren
      • Responsive Jquery Modal Box
      • Google Tidak Menyukai Blog Spam dan Ini Cara Mengh...
      • 5 Cara Terbaik Membuat Pengunjung Berlama-lama di ...
      • Anizan Alternatif Google Adsense
      • Cara Menambahkan Tombol On Off Video Di Blogger
      • Template Blogger Thesisense SEO Friendly 2014
      • Jquery Image Crousel Slider For Blogger
      • Slider with thumbnails For Blogger
      • Cara membuat efek Rotasi + Shadow pada Gambar Blog
      • Tuama Minahasa Template Blogger Responsive
      • Sisense Blogger Template
      • Cara memasang Iklan Di Bawah Artikel/Postingan
      • Cara Proteksi CSS Menggunakan Base64
      • Daftar Peserta Kontes SEO TemplatePremium
      • Jenis Jenis Doctype
      • Template Minima Colored 2.1 Final
      • Cara Memasang Scroll Arsip/Archive Blog Dengan Mudah
      • Related Posts Blogger : 6 in 1
      • Auto ReadMore dengan Gambar tanpa Javascript
      • Membuat Demo JSFiddle di Blog dengan JQuery
      • Iklan Gambar ala Google AdSense
      • Jquery Image Tooltip
      • Banned Spammer di Komentar Blog
      • Random Post Fast Loading
      • Menampilkan Pesan Pada Jam Tertentu
      • Apa Itu Backlink
      • You Comment I Follow
      • Anime First Responsive Blogger Template
      • CSS Sprite
    • ►  Agustus (8)

Mengenai Saya

Unknown
Lihat profil lengkapku
Copyright 2014 Tutorial Blogspot - All Rights Reserved
Template by Dino Desain - Powered Blogger