$(document).ready(function(){

	$(".dropdown").on("show.bs.dropdown", function(event){
		var pos		= $(this).offset(),
			drop	= $(this).find(".dropdown-menu"),
			toggle	= $(this).find(".dropdown-toggle"),
			windowX = $(window).width();

		//remove class
		drop.removeClass("dropdown-menu-right");

		if ((pos.left + drop.width()) > windowX)	{
			drop.addClass("dropdown-menu-right");
		}
	});

});

$(window).on("load" , function() {

	$(".widget-title-drop").each(function() {
		var el		= $(this),
			drop	= $(this).find(".dropdown-menu"),
			toggle	= $(this).find(".dropdown-toggle");

		if (toggle.outerWidth() > drop.outerWidth()) {
			drop.css("min-width" , toggle.outerWidth());
		}

	});

});