Bootstrap popover, image as content

As it currently stands your this is referencing the current scope, whereas you want to be referencing the element which the Popover instance is attached to. This is done simply by wrapping the expression you have for content in a function: $(‘a[rel=popover]’).popover({ html: true, trigger: ‘hover’, content: function () { return ‘<img src=”‘+$(this).data(‘img’) + ‘” … Read more

Bootstrap’s popover only working on buttons – not anchors or spans

Ok so it turns out there is a bug in Twitter Bootstrap. It has been opened and closed a couple times. There is currently a work around: 1) Do not use trigger: focus when initializing bootstrap popovers 2) Instead use data-trigger=”focus” as an attribute to the items which will trigger the popover 3) Items which … Read more

How to correctly present a popover from a UITableViewCell with UIPopoverArrowDirectionRight or UIPopoverArrowDirectionLeft

You’re getting the frame from the cell via the rectForRowAtIndexPath method. This is correct. However the tableview is most likely a subview of a larger iPad view so when the popover gets the coordinates it thinks they’re in the larger view. This is why the popover appears in the wrong place. Example, the CGRect for … Read more

Bootstrap popover is not working

From the Docs on Popovers: Opt-in functionality: For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning you must initialize them yourself. So you must call .popover() manually in JavaScript like this: $(“[data-toggle=popover]”).popover(); Or you can use whatever selector you want Here’s an example using StackSnippets. $(“[data-toggle=popover]”).popover(); body { padding: 50px; } <link href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css” … Read more

How do I adjust my popover to the size of the content in my tableview in swift?

In your UITableViewController’s viewDidLoad() you can add an observer: self.tableView.addObserver(self, forKeyPath: “contentSize”, options: .new, context: nil) Then add this method: override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { self.preferredContentSize = tableView.contentSize } Lastly, in viewDidDisappear(), make sure you remove the observer: tableView.removeObserver(self, forKeyPath: “contentSize”) This way the popover … Read more

How to change the size of a popover

Set the preferred content size on the view controller being presented not the popoverPresentationController override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) // func for popover { if segue.identifier == “popoverView” { let vc = segue.destinationViewController vc.preferredContentSize = CGSize(width: 200, height: 300) let controller = vc.popoverPresentationController controller?.delegate = self //you could set the following in your storyboard … Read more

tech