Bootstrap (by Twitter) loading in page content for Popovers
Bootstrap is a nice get started HTML/CSS/JS interface toolkit. At $work our newest design has been based on it and many of its components.
One of the challenges I've run into with the Popover element is generating in attribute content for complex elements.
The basic context is:
The popover gets the body from the data-content attribute. The other option that doesn't appear to be documented is using a function set in the options.
This will load the html content from element '#popover-content' when calling 'show' on popover.
Note: If trigger element still has a data-content element, even if its empty, the content function will not be called by method.
My biggest issue still with Bootstrap tools is that they are not generally designed to be used with externally loaded content. Therefore to load this type of content I still need to setup lots of manually event handlers. It seems like jQuery Tools has a bit more complete event model today. But Bootstrap is still very young.
__END__
One of the challenges I've run into with the Popover element is generating in attribute content for complex elements.
The basic context is:
<a id="mypopover" href="#" data-content="stuff to display"> Label </a>
The popover gets the body from the data-content attribute. The other option that doesn't appear to be documented is using a function set in the options.
$('#mypopover').popover({ // other options here content: function(ele) { return $('#popover-content').html(); } });
This will load the html content from element '#popover-content' when calling 'show' on popover.
Note: If trigger element still has a data-content element, even if its empty, the content function will not be called by method.
My biggest issue still with Bootstrap tools is that they are not generally designed to be used with externally loaded content. Therefore to load this type of content I still need to setup lots of manually event handlers. It seems like jQuery Tools has a bit more complete event model today. But Bootstrap is still very young.
__END__
Brilliant, thx!
ReplyDeleteIn the documentation it states that u can use a function as content, but there was no documentation as to how to use it (what it should return etc)
Hi Lee.
ReplyDeleteI'm using your plugin to show one div with two buttons: One to show a alert and other to close the popover.
The close button works very well, but the alert isn't shown.
See my code
I'll appreciate if you could answer.
Thanks a lot ;)
Hi Lee.
ReplyDeleteI tried a little more and I made this way:
http://monteirobrena.wordpress.com/2012/07/27/popover-customizado-com-twitter-bootstrap-e-jquery
Thanks!
ReplyDeleteWhat Dogoku said :)
Thanks for this, will give a try.
ReplyDelete404 on http://flowplayer.org/tools/index.html (jquery tools link)
Merci beaucoup :)
ReplyDeleteI want you to thank for your time of this wonderful read!!! I definately enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog!!!! free stock photos
ReplyDeletesms are messaging software for business to send marketing & advertising SMS messages to customers with mobile phone from PC in this site SMS Marketing software
ReplyDeleteUseful article for bootstrap learners, thanks for sharing. https://www.technologist360.com/
ReplyDeleteadmire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much.
ReplyDeleteBootstrap Training in Chennai
I'm greatly impressed by your article. That's a lot of information. Thanks for sharing this informative post.
ReplyDeleteJavascript Training in Chennai | Javascript Training Center in Chennai | Javascript Training Institute in Chennai | Javascript Course
Such an amazing blog with new updates. I love to learn more about this topic. Waiting for more like this.
ReplyDeleteMicrosoft Dynamics crm Training in Chennai
Microsoft Dynamics Training in Chennai
Microsoft Dynamics crm Training institutes in Chennai
Salesforce Training in Chennai
AngularJS Training in Chennai
Tally Training in Chennai
ccna course in Chennai
Microsoft Dynamics crm Training in Velachery
Microsoft Dynamics crm Training in T Nagar
Microsoft Dynamics crm Training in OMR
Borgata Hotel Casino & Spa - Mapyro
ReplyDeleteBorgata Hotel 전라남도 출장샵 Casino 광명 출장마사지 & Spa, Atlantic City, 전라북도 출장안마 NJ. Map. See map. View reviews. Location. Borgata Hotel Casino 군포 출장안마 & 대전광역 출장샵 Spa,