Embed plug-ins using Bootstrap's PopOver tag and implement Ajax and background interaction for plug-in registration events

Source: Internet
Author: User

In the afternoon a study of Bootstrap's PopOver wrote an example. If the project needs to be used in many places can consider encapsulation into plug-ins.

JavaScript code:

1<script type= "Text/javascript" >2         var_types = ' 0 ';3         var_status = ' 0 ';4        5$(function () {6 Loadfilter ();7         });8 9         functionsearch () {Ten $.ajax ({ One                 .... A             }); -         } -  the         functionLoadfilter () { -             var_content = ' '; -_content + = ' <div class= "Menu-item" _t= "Types" ><span class= "title" > Type </span> ' -_content + = ' <div class= ' btn-group ' > ' +_content + = ' <button id= "types_0" _v= "0" type= "button" class= "btn btn-default btn-xs" > All </button> ' -_content + = ' <button id= "Types_1" _v= "1" type= "button" class= "btn btn-default btn-xs" > Revenue </button> ' +_content + = ' <button id= "types_2" _v= "2" type= "button" class= "btn btn-default btn-xs" > Expenses </button> ' A_content + = ' </div> ' at_content + = ' </div> ' -_content + = ' <div class= ' menu-item ' _t= ' status ' ><span class= ' title ' > Status </span> ' -_content + = ' <div class= ' btn-group ' > ' -_content + = ' <button id= "status_0" _v= "0" type= "button" class= "btn btn-default btn-xs" > All </button> ' -_content + = ' <button id= "Status_1" _v= "1" type= "button" class= "btn btn-default btn-xs" > Edit </button> ' -_content + = ' <button id= "status_2" _v= "2" type= "button" class= "btn btn-default btn-xs" > Edit complete </button> ' in_content + = ' <button id= "Status_3" _v= "3" type= "button" class= "btn btn-default Btn-xs" > Review complete </button> ' -_content + = ' </div> ' to_content + = ' </div> ' +  -$ (' #btnFilter '). PopOver ({ thePlacement: ' Bottom ', *Trigger: ' Manual ', $Html:true,Panax Notoginseng content: _content -}). On (' click ',function () { the                 var_this = This; +$( This). PopOver (' Show '); A$( This). On (' Shown.bs.popover ',function () { the$ (document). Bind ("click",function(e) { +                         vartarget =$ (e.target); -                         if(Target.closest (". PopOver"). Length = = 0) { $$ (_this). PopOver (' Hide '); $                         } -                     }); -  the$ ("div[_t= ' types ')"). Find ("button[_v=" + _types + "']"). AddClass (' active '); -$ ("div[_t= ' status ']"). Find ("button[_v=" + _status + "']"). AddClass (' active ');Wuyi  the$ ("div[_t= ' types ')"). Find (' button '). Unbind (' click ')); -$ ("div[_t= ' types ')"). Find (' button '). Bind (' click ',function () { Wu$ ("div[_t= ' types ')"). Find (' button '). Removeclass (' active '); -$( This). addclass (' active '); About_types = $ ( This). attr ("_v"); $ search (); -                     }); -  -$ ("div[_t= ' status ']"). Find (' button '). Unbind (' click ')); A$ ("div[_t= ' status ']"). Find (' button '). Bind (' click ',function () { +$ ("div[_t= ' status ']"). Find (' button '). Removeclass (' active '); the$( This). addclass (' active '); -_status = $ ( This). attr ("_v"); $ search (); the                     }); the                 }); the$( This). On (' Hidden.bs.popover ',function () { the $ (document). Unbind (); -                 }); in             }); the         } the</script>

Embed plug-ins using Bootstrap's PopOver tag and implement Ajax and background interaction for plug-in registration events

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.