)
HTML
<div class="yui-u">
<div class="sect">
<div class="sect-hd">
<h2>Menu with Icons</h2>
</div>
<div class="sect-tip">Click the icons!</div>
<div class="sect-bd">
<div class="icons-image">
<a class="mail" href="javascript:void(0)" title="Mail"></a>
<a class="calendar" href="javascript:void(0)" title="Calendar"></a>
<a class="folder" href="javascript:void(0)" title="Folder"></a>
<a class="smile" href="javascript:void(0)" title="Smile"></a>
</div>
</div>
</div>
</div>
CSS
#dashboard-special-content .icons-image a {
display: inline-block;
width: 48px;
height: 48px;
}
#dashboard-special-content .icons-image a.mail {
background-image: url('/images/dashboard/icons/mail-icon.png');
}
#dashboard-special-content .icons-image a.calendar {
background-image: url('/images/dashboard/icons/calendar-icon.png');
}
#dashboard-special-content .icons-image a.folder {
background-image: url('/images/dashboard/icons/folder-icon.png');
}
#dashboard-special-content .icons-image a.smile {
background-image: url('/images/dashboard/icons/smiley-icon.png');
}
#dashboard-special-content .icons-image a.smile:hover {
background-image: url('/images/dashboard/icons/smiley-laugh-icon.png');
}
JavaScript
Proteus.addHandler("load", function() {
$('#dashboard-special-content .icons-image a').on('click', function() {
const imgTitle = $(this).attr('title');
$('#dashboard-special-content .icons-image').after('<div class="you-clicked-msg">You clicked the icon for ' + imgTitle + ' !</div>');
});
});
Operation Check
The four icons are displayed as shown in the picture below.
When you hover the mouse cursor over the rightmost "Smily icon", the mouth opens, and when you click on an icon, the name of the clicked icon is displayed.