JSFiddle - React, Tailwind, and code Playground

by zlojnaxa

HTML

<div id="small_logo">small_logo</div>
<div class="sidebar">sidebar</div>

CSS

#small_logo{
	width:  100px;
	height:  100px;
	background:  #890;
	margin-left: 30px;
	text-align:  center;
}

.sidebar{
	width:  100px;
	height:  100px;
	background: #5e76ff;
	position: relative;
	text-align:  center;
}

JavaScript

if ($("#small_logo").length) {
	var top_logo  = $('#small_logo').offset().left; 
	console.log(top_logo);
	$('.sidebar').css('left', top_logo + 'px');
}