mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-29 23:09:05 +02:00
adds twipsy js to regular index for positioning
This commit is contained in:
@@ -42,42 +42,15 @@ $(document).ready(function(){
|
||||
// POSITION STATIC TWIPSIES
|
||||
// ========================
|
||||
|
||||
$('.twipsies.well a').each(function () {
|
||||
var type = this.title
|
||||
, $anchor = $(this)
|
||||
, $twipsy = $('.twipsy.' + type)
|
||||
|
||||
, twipsy = {
|
||||
width: $twipsy.width() + 10
|
||||
, height: $twipsy.height() + 10
|
||||
}
|
||||
|
||||
, anchor = {
|
||||
position: $anchor.position()
|
||||
, width: $anchor.width()
|
||||
, height: $anchor.height()
|
||||
}
|
||||
|
||||
, offset = {
|
||||
above: {
|
||||
top: anchor.position.top - twipsy.height
|
||||
, left: anchor.position.left + (anchor.width/2) - (twipsy.width/2)
|
||||
}
|
||||
, below: {
|
||||
top: anchor.position.top + anchor.height
|
||||
, left: anchor.position.left + (anchor.width/2) - (twipsy.width/2)
|
||||
}
|
||||
, left: {
|
||||
top: anchor.position.top + (anchor.height/2) - (twipsy.height/2)
|
||||
, left: anchor.position.left - twipsy.width - 5
|
||||
}
|
||||
, right: {
|
||||
top: anchor.position.top + (anchor.height/2) - (twipsy.height/2)
|
||||
, left: anchor.position.left + anchor.width + 5
|
||||
}
|
||||
}
|
||||
|
||||
$twipsy.css(offset[type])
|
||||
});
|
||||
$(".twipsies a").each(function () {
|
||||
$(this)
|
||||
.twipsy({
|
||||
live: false
|
||||
, placement: $(this).attr('title')
|
||||
, trigger: 'manual'
|
||||
, offset: 2
|
||||
})
|
||||
.trigger('twipsy:show')
|
||||
})
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user