定制 apancutt/bsutils 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

apancutt/bsutils

最新稳定版本:v0.0.2

Composer 安装命令:

composer require apancutt/bsutils

包简介

JavaScript utilities for use with Twitter Bootstrap.

README 文档

README

JavaScript utilities for use with Twitter Bootstrap.

Requirements

  • Twitter Bootstrap 3.0+

Installation

Ensure bsutils-core.min.js is included at the bottom of your page then initalize a new BsUtils instance:

    <!-- ... -->

    <script src="bsutils-core.min.js"></script>

    <script>
        (function() {

            var bsutils = new BsUtils();
            // ...

        }) ();
    </script>

  </body>
</html>

Modules

Out-of-the-box, bsutils doesn't do much. The juice comes from modules. You'll need to manually include the module(s) you required into your page in order to use them.

<script src="bsutils-core.min.js"></script>
<script src="bsutils-module-mymodule.min.js"></script>

<script>
    (function() {

        var bsutils = new BsUtils({
            mymodule_options = {}
        });

        var mymodule = bsutils.module("mymodule"); // Will be initialized with mymodule_options

        // ...

    }) ();
</script>

version Detect Bootstrap CSS version

Support for this functionality is currently not provided by Bootstrap so you will need to compile your own Bootstrap LESS/SASS files for it to work.

LESS Installation

In variables.less add:

@version: "3.3.1"; // Replace with the version that you are using

In utilities.less add:

.bootstrap-version {
  &:extend(.hidden);
  &:after {
    content: $version
  }
}
SCSS Installation

In _variables.scss add:

$version: "3.3.1"; // Replace with the version that you are using

In _utilities.scss add:

.bootstrap-version {
  @extend .hidden;
  &:after {
    content: $version
  }
}
Options
Name Type Default Description
container HTMLElement document.body Container for generated version sniffer element.
tag string DIV HTML element tag for generated version sniffer element.
Methods
get() string Returns the Twitter Bootstrap version.
Examples
var bsutils = new BsUtils();

// Get the Bootstrap version (e.g. "3.3.1")
console.log(bsutils.module("version").get());

viewport Detect the active viewport

Options
Name Type Default Description
container HTMLElement document.body Container for generated viewport sniffer elements.
tag string DIV HTML element tag for generated viewport sniffer elements.
Methods
all() array Returns all known viewports.
get() string Returns the current viewport.
is(string viewport) boolean Returns true if current viewport matches viewport.
lt(string viewport) boolean Returns true if current viewport is less than viewport.
lte(string viewport) boolean Returns true if current viewport is less than or equal to viewport.
gt(string viewport) boolean Returns true if current viewport is greater than viewport.
gte(string viewport) boolean Returns true if current viewport is greater than or equal to viewport.
Examples
var bsutils = new BsUtils();

// Get the current viewport (e.g. "xs", "md", etc.)
console.log(bsutils.module("viewport").get());

// Test the current viewport
console.log(bsutils.module("viewport").is("xs")); // TRUE only if current viewport is "xs"
console.log(bsutils.module("viewport").lt("md")); // TRUE only if current viewport is "xs" or "sm"
console.log(bsutils.module("viewport").lte("md")); // TRUE only if current viewport is "xs" or "sm" or "md"
console.log(bsutils.module("viewport").gt("md")); // TRUE only if current viewport is "lg"
console.log(bsutils.module("viewport").gte("md")); // TRUE only if current viewport is "lg" or "md"

统计信息

  • 总下载量: 5.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固