Tag Archives: CSS3

How To Add a Circle or a Small Dot Around The Date in The FullCalendar Plugins

About a month ago, I got a small project about full calendar plugins. So at that time, my customer wanted the calendar to look tidy even though there were a lot of agenda piles on that date. Honestly, I’ve never tried this before so I’m not saying I can do it right away.

Then I tried to find related references to it, but I couldn’t find it … I tried several times and it worked .. yeah …

Here is a sample code that I modified a little from the original, of course, this code is messy and has not been optimized. If you have any recommendations regarding a similar project, feel free to let me know because I am very happy to improve this code.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Agenda</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no" />
	
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css"/>
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
	<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.css' />

	<style>
			.fc-ltr .fc-basic-view .fc-day-top .fc-day-number{
				float: none;
				font-size: 38px;
			}
			.fc-row .fc-content-skeleton td, .fc-row .fc-helper-skeleton td{
				text-align: center;
			}
			.navigation-detail{
				color:red !important;
				text-align: right;
				font-size: 22px;
				padding-right: 5px;
			}
	</style>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js'></script>
	<script src='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.js'></script>
</head>
<body>

	<div id="calendar"></div>

	<script>
		 ajax_calendar();
		 
		 function ajax_calendar(){
			$.ajax({
			   url: "https://www.example.com/json",
			   success: function(result){
				  $('#calendar').fullCalendar({
					 events : result,
					 eventColor : 'green',
					 eventTextColor : 'white',
					 eventRender: function(eventObj, $el) {
						if(eventObj.status == 'batal'){
						   $el.css('text-decoration-line', 'line-through');
						}


						var tanggal = eventObj._start._i;
							tanggal = tanggal.substring(0, 10);
							tanggal = replace_all(tanggal, '-', '');
						$el.addClass('tanggal-full tanggal-' + tanggal);

					 },

					 eventAfterAllRender: function(){
						$('.fc-day-top').each(function(index, element) {
							var tanggal = $(this).data('date');
								tanggal = replace_all(tanggal, '-', '');
							var navigation = '<div class="navigation-detail" id="tanggal-'+tanggal+'"><span class="fa fa-circle fa-1x" data-id="tanggal-'+tanggal+'"></span></div>';
							
							$("a.tanggal-" + tanggal).hide();

							if($(this).parent().parent().next().children().children().eq(0).hasClass('fc-event-container') && $(this).parent().parent().next().children().children().eq(0).children().hasClass('tanggal-'+tanggal)){
								$(this).append(navigation);
							}

							if($(this).parent().parent().next().children().children().eq(1).hasClass('fc-event-container') && $(this).parent().parent().next().children().children().eq(1).children().hasClass('tanggal-'+tanggal)){
								$(this).append(navigation);
							}

							if($(this).parent().parent().next().children().children().eq(2).hasClass('fc-event-container') && $(this).parent().parent().next().children().children().eq(2).children().hasClass('tanggal-'+tanggal)){
								$(this).append(navigation);
							}

							if($(this).parent().parent().next().children().children().eq(3).hasClass('fc-event-container') && $(this).parent().parent().next().children().children().eq(3).children().hasClass('tanggal-'+tanggal)){
								$(this).append(navigation);
							}

							if($(this).parent().parent().next().children().children().eq(4).hasClass('fc-event-container') && $(this).parent().parent().next().children().children().eq(4).children().hasClass('tanggal-'+tanggal)){
								$(this).append(navigation);
							}

							if($(this).parent().parent().next().children().children().eq(5).hasClass('fc-event-container') && $(this).parent().parent().next().children().children().eq(5).children().hasClass('tanggal-'+tanggal)){
								$(this).append(navigation);
							}

							if($(this).parent().parent().next().children().children().eq(6).hasClass('fc-event-container') && $(this).parent().parent().next().children().children().eq(6).children().hasClass('tanggal-'+tanggal)){
								$(this).append(navigation);
							}
						});
					 },
					 selectable : true,
					 locale: 'id',
					 height   : 800,
					 editable : false,
					 header: {
						left   : 'month,agendaWeek,agendaDay',
						center : 'title',
						right  : 'today prev,next',
					 },
				  });
			   }
			});
		 }
		
		$(document).on("click", ".navigation-detail .fa", function() {
			var tanggal = $(this).data('id');

			$("a." + tanggal).slideToggle("slow");

			if($(this).hasClass('fa-circle-o')){
				$(this).addClass('fa-circle');
				$(this).removeClass('fa-circle-o');
			} else {
				$(this).removeClass('fa-circle');
				$(this).addClass('fa-circle-o');
			}
		});

		function replace_all(string, search, replace) {
			return string.split(search).join(replace);
		}
	</script>
</body>
</html>

Happy Coding!

How to Make an Iframe With The Play Button

Recently I got a simple project to create an iframe that contains a play button. So, when the user clicks the button, the elements in the iframe will run or reload. In my case, the element that is reloaded or executed is a game link.

I got a similar code example from this link. But the difference in the link is to execute a video play button from YouTube to play the movie.

I’m trying to change some code so that it suits my customers’ wishes. The following code that I customize.


<!DOCTYPE html>
<html>
<head>
    <title>.: IFRAME :.</title>
    <style type="text/css">
        .wrapper-video {
            position:relative;
            width:640px;
            height: 426px;
        }
        .wrapper-video img {
            width:640px;
            height: 426px;
            height:auto;
        }
        .wrapper-video iframe {
            display:none;            
            background: #DADADA;
            width:640px;
            height: 426px;
        }
        .play-btn-video {
            position:absolute;
            z-index:666;
            top:50%;
            left:50%;
            transform:translate(-50%, -50%);
            background-color:transparent;
            border:0;
        }
        .play-btn-video:hover {
            cursor:pointer;
        }
        .play-btn-video:focus {
            outline:0;
        }
    </style> 

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>   
    
    <script>
        $(document).on("click","#play",function() {     
            $('#player').show();
            var url = $(this).data('info');
            $('#player').attr('src', url);
            $('#video-cover').hide();
            $('#play').hide();
        });
    </script>
</head>

<body>
    <div class="wrapper-video">

        <!-- COVER -->
        <img  id="video-cover" src="cover.png" alt="Video title">

        <!-- IFRAME VIDEO -->
        <iframe id="player" width="640" height="426" src="" frameborder="0" allow="autoplay" allowfullscreen></iframe>

        <!-- PLAY BUTTON -->
        <button id="play" class="play-btn-video" data-info="https://staticpff.yggdrasilgaming.com/init/launchClient.html?gameid=7322">
            <svg enable-background="new 0 0 141.73 141.73" height="141.73px" id="Warstwa_1" version="1.1" viewBox="0 0 141.73 141.73" width="141.73px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M101.628,40.092c-8.22-8.22-19.149-12.746-30.774-12.746c-11.624,0-22.553,4.526-30.772,12.746   c-16.968,16.969-16.967,44.578,0.001,61.546c8.22,8.22,19.149,12.747,30.773,12.747s22.553-4.526,30.772-12.746   s12.747-19.148,12.747-30.773S109.848,48.312,101.628,40.092z M100.214,100.225c-7.842,7.842-18.269,12.16-29.358,12.16   s-21.517-4.319-29.359-12.161c-16.188-16.188-16.188-42.529-0.001-58.718c7.842-7.842,18.269-12.16,29.358-12.16   c11.091,0,21.518,4.318,29.36,12.16c7.842,7.843,12.161,18.269,12.161,29.359S108.056,92.382,100.214,100.225z" fill="#ffffff"/><path d="M65.893,55.983c-0.391-0.391-1.023-0.391-1.414,0s-0.391,1.023,0,1.414l13.466,13.466L64.478,84.331   c-0.391,0.391-0.391,1.023,0,1.414c0.195,0.195,0.451,0.293,0.707,0.293s0.512-0.098,0.707-0.293L80.065,71.57   c0.391-0.391,0.391-1.023,0-1.414L65.893,55.983z" fill="#ffffff"/></g></svg>
        </button>
    </div>
</body>
</html>

If you have an alternative or simpler code, don’t hesitate to share it here. I am very grateful if you want to share and take the time to criticize my writing. Bye..bye.