each - index - hover - fixed center > jQuery / Script

본문 바로가기
gnb bg


jQuery / Script

jQuery / Script

each - index - hover - fixed center

본문

//---------------------------------------------------------------------------

//  tooltip_switch -

//---------------------------------------------------------------------------

function tooltip_switch() {

$('.sec_tooltip').each(function(index, value) { 


$(this).addClass('toolBtn_' + index);

$('.tooltip_desc').eq(index).addClass('toolDesc_' + index);


var toolDescEl = $('.toolDesc_' + index);

var toolEl = $('.toolBtn_' + index);

var toolX = toolEl.offset().left;

var toolY = toolEl.offset().top;

var toolHalfWidth = toolEl.width() / 2;

var toolHalfHeight = toolEl.height() / 2;

var toolCenterX = toolX + toolHalfWidth;

var toolCenterY = toolY + toolHalfHeight;

$(toolEl).hover( function(e) {

$(document).find('.toolDesc_' + index).stop(true,true).css({"left" : toolCenterX,"top" : toolCenterY}).show();

}, function () {

$('.tooltip_desc').hide();

});


$(toolDescEl).hover( function(e) {

$(this).show();

}, function () {

$('.tooltip_desc').hide();

});



});


}

댓글목록

등록된 댓글이 없습니다.


Copyright 2005-2020 UNIDA_v7. All rights reserved.