Ads

Wednesday, 23 July 2014

jQuery Responsive Bootstrap Modal

Download   Demo


Extends Bootstrap’s native modals to provide additional functionality. Introduces a ModalManager class that operates behind the scenes to handle multiple modals by listening on their events.


A single ModalManager is created by default on body and can be accessed through the jQuery plugin interface.


$('body').modalmanager('loading');

Bootstrap-Modal can be used as a replacement for Bootstrap’s Modal class or as a patch to the library.


Bootstrap 3


If you’re using BS3, I’ve provided a compatible css patch. Include bootstrap-modal-bs3patch.css before the main bootstrap-modal.css file to use this plugin with Bootstrap 3.


If you’re using the loading spinner functionality you may also need to change the default template to be compatible in js:


$.fn.modal.defaults.spinner = $.fn.modalmanager.defaults.spinner = 
'<div class="loading-spinner" style="width: 200px; margin-left: -100px;">' +
'<div class="progress progress-striped active">' +
'<div class="progress-bar" style="width: 100%;"></div>' +
'</div>' +
'</div>';

Note: Since this plugin was created to solve a lot of the issues with BS2, it still uses the BS2 markup syntax. Currently I believe the default BS3 modal addresses some of the bigger issues and is not worth maintaining two versions of this plugin.


Overview


  • Backwards compatible

  • Responsive

  • Stackable

  • Full width

  • Load content via AJAX

  • Disable background scrolling

Installation


  • Include css/bootstrap-modal.css after the main bootstrap css files.

  • Include js/bootstrap-modalmanager.js and js/bootstrap-modal.js after the main bootstrap js files.

Options


In addition to the standard bootstrap options, you now have access to the following options


Modal


ModalManager


  • loading Toggle the loading state.

  • backdropLimit Limit the amount of backdrops that will appear on the page at the same time.

  • spinner Provide a custom image or animation for the loading spinner.

  • backdropTemplate Provide a custom modalmanager backdrop. This backdrop is used when $element.modalmanager('loading') is called.

Disable Background Scrolling


If you want to prevent the background page from scrolling (see demo for example) you must wrap the page contents in a <div class="page-container">. For example:


<body>
<div class="page-container">
<div class="navbar navbar-fixed-top">...</div>
<div class="container">...</div>
</div>
</body>

The reason for doing this instead of just simply setting overflow: hidden when a modal is open is to avoid having the page shift as a result of the scrollbar appearing/disappearing. This also allows the document to be scrollable when there is a tall modal but only to the height of the modal, not the entire page.


Constrain Modal to Window Size


You can bind the the height of the modal body to the window with something like this:


$.fn.modal.defaults.maxHeight = function()
// subtract the height of the modal header and footer
return $(window).height() - 165;


Note: This will be overwritten by the responsiveness and is only set when the modal is displayed, not when the window is resized.


Tab Index for Modal Forms


You can use data-tabindex instead of the default tabindex to specify the tabindex within a modal.


<input type="text" data-tabindex="1" />
<input type="text" data-tabindex="2" />

See the stackable example on the demo page for an example.



jQuery Responsive Bootstrap Modal

Mention.js : Add functionality to Twitter Bootstraps Typeahead plugin

Download   Demo


Mention.js


Lightweight (min: 1.92kb, full: 4.07kb) wrapper for adding @user mention functionality to Twitter Bootstraps Typeahead plugin.


This enables you to have Twitter-like user mentions in textareas


Usage


The users parameter accepts an array of objects. Each object must have a username key in order for this script to work.



$("#multi-users").mention(
delimiter: '@',
users: [
username: "ashley"
,
username: "roger"
,
username: "frecklefart123"
]
);


Sensitivity



$("#multi-users").mention(
sensitive: true,
users: [
username: "sarah"
,
username: "bigRat"
,
username: "roger"
,
username: "Ricky"
]
);


With sensitivity set to true, items are ordered by the following divisions of priority:


  • Highest: If first letter matches exactly

  • High: If first letter matches regardless of case

  • Med: If target has matching letters’ case

  • Low: if target has matching character regardless of case

Sensitivity Examples:


If you were to query "@r", with sensitivity on, the resulting list will be ["roger", "Ricky", "sarah", "bigRat"], but if you were to query "@R", the resulting list would be ["Ricky", "roger", "bigRat", "sarah"]


Full Names, Images, and Query By


If you have a name and/or image key in one of your user objects, there name and image will appear as such in the dropdown list.


The queryBy parameter accepts an array of strings that represent keys in your user object that you would like to query against. For example, if you were to type in the name “@Scott”, the script would match the username “@bigCat”. username is required for this script to work.



$("#multi-users").mention(
queryBy: ['name', 'username'],
users: [
username: "sarah",
name: "Sarah Jones",
image: "http://placekitten.com/25/25"
,
username: "bigCat",
name: "Scott Pfaff",
image: "http://placekitten.com/25/25"
,
username: "coderDude",
name: "Roger Penn",
image: "http://placekitten.com/25/25"
]
);


Empty Querying


You may query for users simply by pressing your delimiter. For example, pressing the @ symbol will return all users that are a part of your users list, so long as those users adhere to the typeaheadOpts.items limit



$('#multi-users').mention(
emptyQuery: true,
typeaheadOpts:
items: 10 // Max number of items you want to show
,
users: [...]
);


Defaults



$("#multi-users").mention(
users: [], // Array of Objects
delimiter: '@', // Username Delimiter
sensitive : true,
queryBy: ['name', 'username'],
typeaheadOpts: // Settings for Typeahead
matcher: _matcher, // Mention.js's custom matcher function, don't change
updater: _updater, // Mention.js's custom updater function, don't change
sorter: _sorter, // Mention.js's custom sorter function, don't change

);




Mention.js : Add functionality to Twitter Bootstraps Typeahead plugin

jQuery Interactive Shopping Cart

Download   Demo





This is a smart interactive Shopping Cart jQuery plugin based on Bootstrap framework.


Features:


  • Very easy to install!

  • Full AJAX implementation code.

  • Well documented code.

  • HTML5 & Valid CSS .

  • Cross-platform.

  • Easy to customize.





jQuery Interactive Shopping Cart

jQuery Mobile Twitter Bootstrap Theme

 


Download   Demo


Bootstrap jQuery Mobile Theme


A jQuery Mobile theme based on Bootstrap.


The title says it all. I thought it would be a fun project to build out a jQuery Mobile theme emulating everyone’s favorite hotness, the Bootstrap UI library. It’s not a perfect translation of course, but consider it a work in progress.


This theme overrides the existing jQuery Mobile A – E swatches (and adds an F swatch as well) with colors and styles found in Bootstrap. It’s meant to be used with A as the primary swatch for the page, and B – F as accents as needed.


Make your Bootstrap theme complete by using Font Awesome icons found in the jQuery Mobile Icon Pack.


**Updated for jQuery Mobile 1.4!



jQuery Mobile Twitter Bootstrap Theme

Bootbox.js – alert, confirm and flexible dialogs for twitter’s bootstrap framework

Download   Demo


Running Tests Build Status


Tests are run using Karma using the Mocha test adapter. To run the tests yourself, simply run npm installwithin the project followed by npm test. Please note that this will require PhantomJS being installed and in your path – if it is not, you may run the tests and capture browsers manually by running karma start from the root of the project.


The project is also hosted on Travis CI - when submitting pull requests please ensure your tests pass as failing requests will be rejected. See the CONTRIBUTING file for more information.


Building a minified release


The repository no longer contains a minified bootbox.min.js file – this is now only generated for releases. To build your own minified copy for use in development simply run npm install if you haven’t already, followed by grunt uglify. This will generate a bootbox.min.js file in your working directory.


A note on Bootstrap dependencies


Bootbox 4.0.0 is the first release to support Bootstrap 3.0.0.


Bootbox 3.3.0 is the last release to support Bootstrap 2.2.x.


Much more dependency information can be found on the Bootbox website.


Roadmap


The latest major release of Bootbox – 4.0.0 – involved a total rewrite of the internal code and introduced an entirely new public API. It has not re-implemented some functionality from the 3.x series as of yet; this will be addressed in the coming weeks in the form of new minor releases; a task list for 4.3.0 is available - please feel free to add feedback and requests.


There is no new major (e.g. 5.x) release on the roadmap at present.


Latest Release: 4.2.0


  • Add Swedish locale

  • Add Latvian locale

  • Add Turkish locale

  • Add Hebrew locale

  • Add password input type

  • Add textarea input type

  • Add date input type

  • Add time input type

  • Add number input type

  • Support DOM selectors for container argument

  • UMD support

  • Better support on mobile devices

For a full list of releases and changes please see the changelog.



Bootbox.js – alert, confirm and flexible dialogs for twitter’s bootstrap framework