0

I am trying to insert a webpage's html into a bootstrap 2.3.2 popover using the following:

 $.ajax({
   type:"POST",
   url: "Ajax/getHtml",
   data: { u : 'http://stackoverflow.com' },
   dataType: 'html',    
   error: function(jqXHR, textStatus, errorThrown) {
     console.log('error');
     console.log(jqXHR, textStatus, errorThrown);
   }
 }).done(function(html) {
   html = html.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '');
   $link = $('<a href="myreference.html" class="p1" data-html="true" data-bind="popover">');
   $link.data('content', html);
   $(this).html($link);
   // Trigger the popover to open
   $link = $(this).find('a');
   $link.popover("show");
});

This works fine but i want to size the output down to lets say 500 x 500 pixels. I checked out:

http://getbootstrap.com/2.3.2/javascript.html#popovers

But do not see a sizing option. How can I do this?

cvrebert
  • 9,075
  • 2
  • 38
  • 49
user1592380
  • 34,265
  • 92
  • 284
  • 515

2 Answers2

0

You can use popover (option "template") from Bootstrap3 http://getbootstrap.com/javascript/#popovers

Just a select popovers from JavaScript components and download it (like a jQuery plugins) http://getbootstrap.com/customize/

Max Lipsky
  • 1,774
  • 1
  • 18
  • 29
0

You can use the CSS max-widthand max-height properties to limit the width and height of the popover. I have provided an example of how to achieve this here: http://jsfiddle.net/z96svdbe/. To avoid having the content overflow the popover, you can set the CSS overflow-y property to auto.

The following CSS will restrict the popover to 300 x 300 pixels.

  .max-width-popover + .popover {
        max-width: 300px;
        max-height: 300px;
        overflow-y: auto;
  }
Mike
  • 1,495
  • 15
  • 11