lots0logs
1/9/2017 - 11:25 PM

WordPress :: Mobile Devices :: Apply CSS Styles Dynamically Based On Android Version

WordPress :: Mobile Devices :: Apply CSS Styles Dynamically Based On Android Version

<script>
(function($) {
	$(document).ready(function() {
		if ($(window).width() < 1024 && false !== navigator.userAgent.search(/Android/)) {
			var version = navigator.userAgent.match(/Android +(\d)\.?(\d+)?\.?(\d+)?/);

			/* ==============================================
			 * ------>>> Target version goes here <<<<------
			 * ============================================== */
			target_version = [4, 1, 0]

			if (null === version || !version.length) {
				return;
			}

			var total_version_parts = version.length - 2,
				index = 0;

			version.shift();

			for (var i = 0; i <= total_version_parts; i++) {
				if (parseInt(version[i]) > parseInt(target_version[i])) {
					return;
				}
			}

			var selector =
				'.et_pb_row_4col, .et_pb_row_1-4_1-4_1-2, .et_pb_row_1-2_1-4_1-4, .et_pb_row_1-4_1-4';

			$(selector).css('display', 'block');
		}
	});
})(jQuery);
</script>