testing, made new popover designs

This commit is contained in:
Zanz2 2018-08-16 16:10:19 +02:00
parent d2373980d4
commit a09834db6a
2 changed files with 43 additions and 26 deletions

View file

@ -2,32 +2,37 @@
'use strict';
$(document).ready(function() {
$('.popover_v2').popover({
html: true,
container: 'body',
placement: 'auto right',
trigger: 'manual',
template: '<div class="popover popover_v2_window" role="tooltip"><div class="popover-body">' +
$('.popover_v2').data('content') +
'</div><div class="popover-footer" style="position:absolute;bottom:5px;right:5px;">' +
'<a class="ax_default link_button" href="https://www.google.si"><i class="fas fa-external-link-alt">nekaj</i></a></div></div>'
}).on("mouseenter", function () {
setTimeout(function () {
$('.popover_v2').popover("show")
var top = $('.popover_v2').offset().top;
$('.popover_v2_window').css({
top: (top) + 'px'
});
$(".popover_v2_window").on("mouseleave", function () {
$('.popover_v2').popover('hide');
});
}, 1000);
}).on("mouseleave", function () {
setTimeout(function () {
if (!$(".popover_v2_window:hover").length) {
$('.popover_v2').popover("hide")
$('.popover_v2').each(function(i,obj) {
$(obj).popover({
html: true,
container: 'body',
placement: 'auto right',
trigger: 'manual',
template: '<div class="popover popover_'+i+'_window" role="tooltip"><div class="popover-body">' +
$(obj).data('content') +
'</div><br><br><div class="popover-footer" style="position:absolute;bottom:5px;right:5px;background-color: #E8E8E8;border-radius: 3px;">' +
'<a style="color:grey;" class="btn btn-link href="https://www.google.si">Read more &nbsp&nbsp<i class="fas fa-external-link-alt"></i></a></div></div>'
}).on("mouseenter", function () {
setTimeout(function () {
if ($(obj).hover().length) {
$(obj).popover("show")
var top = $(obj).offset().top;
$('body').find('.popover_'+i+'_window').css({
top: (top) + 'px'
});
$('body').find(".popover_"+i+"_window").on("mouseleave", function () {
$(obj).popover('hide');
});
}
}, 500);
});
}, 1000);
}).on("mouseleave", function () {
setTimeout(function () {
if (!$('body').find(".popover_"+i+"_window:hover").length) {
$(obj).popover("hide")
}
}, 500);
});
})
});
}());

View file

@ -70,6 +70,18 @@
<!-- profile info -->
<ul class="nav navbar-nav navbar-right">
<!-- search form -->
<li>
<button class="btn btn-default popover_v2" data-content="<%= I18n.t('test.popover.test') %>">
</li>
<li>
<button class="btn btn-default popover_v2" data-content="<%= I18n.t('test.popover.test') %>">
</li>
<li>
<button class="btn btn-default popover_v2" data-content="<%= I18n.t('test.popover.test') %>">
</li>
<li>
<button class="btn btn-default popover_v2" data-content="<%= I18n.t('test.popover.test') %>">
</li>
<li>
<%= form_tag search_path,
method: :get,