Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var setPosition = function ($targetElement, o, $inf) {
- var height = document.body.clientHeight;
- var width = document.body.clientWidth;
- var offsetLeftposition = $targetElement.offset().left;
- var offsetTopposition = $targetElement.offset().top;
- var setLeftposition = (width - (offsetLeftposition + 30 + parseFloat(o.width))) > 0 ? offsetLeftposition + 30 :
- offsetLeftposition - 10 - parseFloat(o.width) > 0 ? offsetLeftposition - (10 + parseFloat(o.width)) :
- offsetLeftposition - (10 + parseFloat(o.width) / 2);
- var settopposition = (height - (offsetTopposition + 30 + parseFloat(o.height))) > 0 ? offsetTopposition + 10 :
- offsetTopposition - (10 + parseFloat(o.height));
- $inf.css('top', settopposition).css('left', setLeftposition);
- }
- any better way to calculate the position and make it responsive?
- the div open on click of some image .(it looks like tooltip).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement