Last active
August 29, 2015 14:00
-
-
Save stevemayhew/11222059 to your computer and use it in GitHub Desktop.
qTip2 Flip Issue with hidden 'at' position.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<title>Flip bug with Overflow</title> | |
<link rel="stylesheet" type="text/css" href="http://cdn.jsdelivr.net/qtip2/2.1.1/jquery.qtip.css"> | |
<link rel="stylesheet" type="text/css" href="qtip-bug.css"> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script> | |
<script type="text/javascript" src="http://cdn.jsdelivr.net/qtip2/2.1.1/jquery.qtip.js"></script> | |
<script type="text/javascript" src="qtip-bug.js"></script> | |
</head> | |
<body> | |
<h1>Overflow Flip Test</h1> | |
<div class="ovf-container"> | |
<ul> | |
<li>One</li> | |
<li>Two</li> | |
<li>Three</li> | |
</ul> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div.ovf-container { | |
margin: 10px; | |
width: 200px; | |
height: 100px; | |
padding: 5px; | |
border: 1px solid red; | |
overflow: hidden; | |
position: relative; | |
} | |
.ovf-container ul { | |
list-style: none; | |
list-style-type: none; | |
position: absolute; | |
width: 1000px; | |
margin: 0; | |
padding: 0; | |
-moz-padding-start: 0; | |
} | |
.ovf-container li { | |
display: inline-block; | |
width: 90px; | |
height: 100px; | |
background: green; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$('li').qtip({ | |
target: $('body'), | |
content: "I'm a Simple Tip", | |
style: { | |
classes: 'qtip-shadow qtip-rounded' | |
}, | |
position: { | |
my: 'left center', | |
at: 'right center', | |
viewport: $(window), | |
adjust: { | |
method: 'flip shift', | |
resize: false, | |
scroll: false, | |
mouse: false | |
} | |
} | |
}); | |
}) |
You need to set the position.viewport
property to the overflow container, not the window
:)
viewport: $('.ovf-container'),
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As you can see the 'right center' corner is hidden by overflow from (the last
While this may seem a strange case, it's a common way carousels of images are done.
Of course the desired behavior would be a flip, even though the tooltip fits the viewport.