Как я могу сделать, чтобы мой Qtip самостоятельно определял атрибуты левого или правого кончика
$('a.tooltip').each(function(){
$(this).qtip({
content: { url: 'includes/qtip.php?'+$(this).attr('rel')+' #'+$(this).attr('div'), text:'loading...' },
show: { delay: 400},
hide: { fixed: true, delay: 200 },
position: {
corner: {
target: 'bottomLeft',
tooltip: 'right'
}
},
style: {
name: 'light',
width: 700
}
});
});
Который я люблю, когда элемент.tooltip находится на правой панели моего сайта, но если нет, то не вижу его завершенным,
как я могу сделать это tooltip:'right'
когда это где-то еще? Я имею в виду, как я могу знать?
2 ответа
Решение
Решение в моем случае, похожем на ваше, было:
position : {
adjust : {
screen : true
}
}
Вы можете найти больше информации в этой теме: Как избежать прокрутки страницы при использовании qtip?
Я думаю, может быть, впервые я отвечу на свой вопрос,
это работает,
$('#panel_derecho a.tooltip').each(function(){
$(this).qtip({
content: { url: 'includes/qtip.php?'+$(this).attr('rel')+' #'+$(this).attr('div'), text:'loading...' },
show: { delay: 400},
hide: { fixed: true, delay: 200 },
position: {
corner: {
target: 'topLeft',
tooltip: 'middleRight'
}
},
style: {
name: 'light',
width: 700
}
});
});
$('#router a.tooltip').each(function(){
$(this).qtip({
content: { url: 'includes/qtip.php?'+$(this).attr('rel')+' #'+$(this).attr('div'), text:'loading...' },
show: { delay: 400},
hide: { fixed: true, delay: 200 },
position: {
corner: {
target: 'topLeft',
tooltip: 'left'
}
},
style: {
name: 'light',
width: 700
}
});
});
Могу ли я оптимизировать это?