function createCookie(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
} else {
var expires = "";
}
document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name, "", -1);
}
$(function() {
// Tampilkan kotak dialog saat halaman telah termuat
$(window).load(function() {
$('#dialog').animate({top:($(window).height()/2)-20}, 400, "swing");
});
// Saat tombol tutup diklik, sembunyikan kotak dialog dengan efek .fedeOut()
// dan buat kuki dengan nama "hideDialog" dengan waktu kadaluarsa 7000 hari
$('a.close').click(function() {
$(this).parent().fadeOut('fast');
createCookie("hideDialog", "hide", 7000);
return false;
});
// Digunakan saat kuki sudah tercipta
// Saat kuki "hideDialog" terbaca, singkirkan kotak dialog
if(readCookie("hideDialog")) {
$('#dialog').remove();
}
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.