小编why*_*to8的帖子

Bootstrap按钮中的Bootstrap datepicker下拉列表

我的要求:我正在使用twitter bootstrap按钮下拉列表(http://twitter.github.io/bootstrap/components.html#buttonDropdowns)并使用bootstrap-datepicker(http://eternicode.github.io/bootstrap-datepicker/#examples)其中一个列表项如下图所示.

在此输入图像描述

根据我的要求,我需要在最后一项中有月历并点击它打开bootstrap-datepicker,我应该能够选择月份和年份.

我面临的问题:当我打开该日期选择器并选择任何月份或年份或点击日期选择器中的任何导航移动到另一个月或一年时,按钮下拉隐藏,但是日期选择器保留在那里,如下图所示.我一直在努力但却无法让它发挥作用.

在此输入图像描述

我的想法(不确定它的正确与否):当我点击datepicker时,它会被直接附加到body元素,因为所有列表项和它们的子项都在html中.因此,即使我尝试停止下拉列表中任何点击的事件传播,它也不会计入datepicker,因为它会附加到正文.(只是为了获取更多信息,我点击其他列表项时定义了一些操作)

如果有人可以帮我解决这个问题,我真的很感激,我真的需要让这个东西适合我的项目.

jquery datepicker event-handling twitter-bootstrap drop-down-menu

12
推荐指数
2
解决办法
2万
查看次数

javascript - 基于多个属性在数组中查找唯一对象

我需要从数组中找到基于2个属性的唯一对象,如下所示.当"class"和"fare"匹配时,我需要提取唯一值并将它们放入结果数组中.

资源:

var arr = [{class:"second", fare: "a"}, 
 {class:"second", fare: "b"},
 {class:"first", fare: "a"},
 {class:"first", fare: "a"},
 {class:"second", fare: "a"},
 {class:"first", fare: "c"}
]
Run Code Online (Sandbox Code Playgroud)

预期结果:

var result = [{class:"second", fare: "a"},
 {class:"second", fare: "b"},
 {class:"first", fare: "a"},
 {class:"first", fare: "c"}
]
Run Code Online (Sandbox Code Playgroud)

我查看了SO,并且能够找到基于一个属性过滤的答案(按属性创建唯一对象的数组),但找不到哪个可以基于2个属性.

javascript arrays

7
推荐指数
3
解决办法
9968
查看次数

Respond.js无法在本地工作 - 支持IE8中的媒体查询

我正在使用bootstrap3模板编写一个html页面,并在其中包含了respond.js,但是当我在IE8上运行它时,它在控制台中给出了错误"访问被拒绝".我正在使用它来使IE8支持媒体查询.我在论坛上尝试了很多东西,但没有运气.respond.js是在本地工作还是我们需要在localhost/web服务器上运行?

Respond.js链接 - https://github.com/scottjehl/Respond

HTML:

<!DOCTYPE html>
<html>
  <head>
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="css/main.css" rel="stylesheet" media="screen">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="js/html5shiv.js"></script>
      <script src="js/respond.js"></script>
    <![endif]-->
  </head>
  <body>
  <div class="container">
    <h1>Hello, world!</h1>

    <div class="main-cont">         
    </div>
</div>        
    <script src="js/jquery-1.10.2.min.js"></script>        
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

CSS - main.css

.main-cont {background:#2d3a42; height:100px;}
Run Code Online (Sandbox Code Playgroud)

localhost internet-explorer-8 media-queries respond.js twitter-bootstrap-3

6
推荐指数
2
解决办法
1万
查看次数

Angular - 广播,$ on在指令中被多次调用

我正在开发一个带有角度的单页应用程序,我需要在2个不同的指令之间进行通信,这些指令基本上没有父子关系.

在指令A中,我有2个地方需要从不同的功能广播相同的事件.在指令B中,已经为此写了一个听众.

现在,我观察到第一次调用callFirstFunc及其广播时,将调用一次监听器.在后续调用时,监听器被调用两次,三次等等,它继续增加.

callFirstFunc被执行时调用callSecondFunc,因此对此的监听器也被称为no.在callFirstFunc中广播的监听器的次数.那么,为什么听众只被调用一次,为什么多次?它每次都在循环和增加.

指令A:

app.directive("firstDir", function ($rootScope) {
    return {
        restrict: 'E',
        link: function (scope, element, attrs) {
            // some other code
            callFirstFunc();
            var callFirstFunc = function(){
                // some other code
                $rootScope.$broadcast("someEvent");
            }
            callSecondFunc();
            var callSecondFunc = function(){
                // some other code
                $rootScope.$broadcast("someEvent");
            }
        }
    };
});
Run Code Online (Sandbox Code Playgroud)

指令B:

app.directive("secondDir", function ($rootScope) {
        return {
            restrict: 'E',
            link: function (scope, element, attrs) {
                // some other code
                scope.$on("someEvent", function(){
                    detectSTuff();
                }) 
               function detectStuff(){
                  // other code
               }                    
            }
        };
    });
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-directive angularjs-scope angular-broadcast

6
推荐指数
1
解决办法
4667
查看次数

Highcharts - 多个字幕 (2)

highcharts 图中是否可以有多个子标题(我需要 2 个)?仅供参考 - 我在副标题之前也有标题。

highcharts

5
推荐指数
1
解决办法
8581
查看次数

CSS3形状和动画 - 箭头

如下图所示,我必须创建此图像并为其设置动画.我打算不为此实际使用图像,而是使用CSS3执行此操作border-radius.所以,下面的HTML和CSS就是我所处的位置.

我想要的动画是箭头应该从底部开始向上移动并沿着流向上移动继续显示,用流向右移动直到箭头指针结束.但我真的不知道怎么能这样做.我必须支持浏览器IE8 +,chrome,FF.

HTML:

<div class="years">
    <article>
        <figure>
            <div class="vrt-bar"></div>
            <div class="hrzt-bar"></div>
            <div class="arrow"></div>
        </figure>
    </article>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.years article figure {
    height:auto;
    position:relative;
}
.years article figure .vrt-bar {
    width:34px;
    height:192px;
    behavior: url(css/PIE.htc);
    border-radius:25px 0 25px 25px;
    -webkit-border-radius: 25px 0 25px 25px;
    -moz-border-radius: 25px 0 25px 25px;
    float:left;
    background:#00b9d3;
    position:relative;

}
.years article figure .hrzt-bar {
    width:143px;
    height:32px;
    background:#00b9d3;
    margin-left:34px;
}
.years article figure .arrow {
    width: 0;
    height: 0;
    border-top: 25px solid transparent;
    border-bottom: 25px solid …
Run Code Online (Sandbox Code Playgroud)

html jquery css3 jquery-animate

2
推荐指数
1
解决办法
3097
查看次数

HTML5时间标记用法

我可以使用HTML时间标签吗?

<time>9:09 PM</time>
Run Code Online (Sandbox Code Playgroud)

我的困惑在于"PM",我是否可以像这样指定它或者时间仅用于显示24小时时钟.

html5 semantic-markup

2
推荐指数
1
解决办法
205
查看次数

动画 - 从水龙头流出的水 - CSS3或jQuery或GIF

我想开发这个动画,如下图所示,这个泵是一个静态图像,我希望水流出这个,如下图和所示方向所示,点击其他元素.这是否可以通过css3或jquery来实现或者我需要一个gif.不胜感激任何有关如何做到这一点的指示?

在此输入图像描述

jquery html5 animation animated-gif css3

1
推荐指数
1
解决办法
2562
查看次数

Angular UI Bootstrap模式 - 使用自定义模态窗口

如链接http://angular-ui.github.io/bootstrap (从顶部的Directive下拉列表中选择模态)中所示,有一个名为windowTemplateUrl的参数,用于覆盖模态内容.因此,如果我们使用它,在templateUrl或模板中给出什么,因为调用modal的open函数需要其中一个.例如,代码如下.

$scope.open = function(){
  var modalInstance = $modal.open({
      windowTemplateUrl : '/client/content.html'
  })
}
Run Code Online (Sandbox Code Playgroud)

如果我运行上面的代码,则会出现需要templateUrl或模板的错误.那么,我如何使用windowTemplateUrl.

javascript angularjs angular-ui-bootstrap bootstrap-modal

0
推荐指数
1
解决办法
2万
查看次数