Adds a nice tooltip when hovering over the content/media picker

#U4-192 Fixed
This commit is contained in:
Sebastiaan Janssen
2012-10-06 11:46:37 -02:00
parent 2b2c75f5e4
commit 5cebbd8a91
2 changed files with 32 additions and 6 deletions

View File

@@ -6,8 +6,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
Umbraco.Controls.TreePicker = function(clientId, label, itemIdValueClientID, itemTitleClientID, itemPickerUrl, width, height, showHeader, umbracoPath) {
var obj = {
_itemPickerUrl: itemPickerUrl,
//_webServiceUrl: umbracoPath + "/webservices/legacyAjaxCalls.asmx/GetNodeName", // legacy service returns string with just node name
_webServiceUrl: umbracoPath + "/webservices/legacyAjaxCalls.asmx/GetNodeBreadcrumbs", // new service returns array representing path/breadcrumbs
_webServiceUrl: umbracoPath + "/webservices/legacyAjaxCalls.asmx/GetNodeBreadcrumbs",
_label: label,
_width: width,
_height: height,
@@ -64,17 +63,35 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
Umbraco.Controls.TreePicker.inst[clientId] = obj;
return obj;
}
};
$(document).ready(function () {
// Tooltip only Text
$('.treePickerTitle').hover(function () {
// Hover over code
var title = $(this).attr('title');
$(this).data('tipText', title).removeAttr('title');
$('<p class="treePickerTooltip"></p>').text(title).appendTo('body').fadeIn('fast');;
}, function () {
// Hover out code
$(this).attr('title', $(this).data('tipText'));
$('.treePickerTooltip').remove();
}).mousemove(function (e) {
var mousex = e.pageX + 10; //Get X coordinates
var mousey = e.pageY + 5; //Get Y coordinates
$('.treePickerTooltip').css({ top: mousey, left: mousex });
});
});
// Static methods
//return the existing picker object based on client id of the control
Umbraco.Controls.TreePicker.GetPickerById = function(id) {
return Umbraco.Controls.TreePicker.inst[id] || null;
};
// instance manager
Umbraco.Controls.TreePicker.cntr = 0;
Umbraco.Controls.TreePicker.inst = {};
})(jQuery);