小编Pav*_*vlo的帖子

Bootstrap响应文本大小

我正在尝试使用bootstrap构建响应式布局,目前正在使用font-size定义一些标题:3em;

但是当布局缩小时,这太大了.我如何能够相应地减小文本的大小?

css responsive-design twitter-bootstrap

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

删除IE上的选择箭头

我有选择元素,我想删除箭头,然后我可以添加其他图标..我可以为Firefox Safari和Chrome做到这一点,但这在IE9上不起作用.

.styled-select select 
{
    border: 0 !important;  /*Removes border*/
    -webkit-appearance: none;  /*Removes default chrome and safari style*/
    -moz-appearance: none;  /*Removes default style Firefox*/
    background: url('select_icon.png')  no-repeat;
     background-position: 179px 7px;
     text-indent: 0.01px;
     text-overflow: "";
     color: #FCAF17;
     width:200px;
 }
Run Code Online (Sandbox Code Playgroud)

查阅小提琴上的IE9.所有我需要的是移除ie9中的箭头请JSFIDDLE回答.

html css html-select css3

121
推荐指数
3
解决办法
15万
查看次数

如何将json加载到我的angular.js ng-model中?

我认为这可能是一个非常明显的问题,但我无法在任何地方找到答案.

我只是想从我的服务器加载一些JSON数据到客户端.现在,我正在使用JQuery通过AJAX调用加载它(下面的代码).

<script type="text/javascript">
var global = new Array();
$.ajax({
    url: "/json",
    success: function(reports){
        global = reports;
        return global;
        }
    });
</script>
Run Code Online (Sandbox Code Playgroud)

它位于html文件中.它到目前为止工作,但问题是我想使用AngularJS.现在,当Angular CAN使用变量时,我无法将整个事物加载到变量中,因此我可以为每个循环使用a.这似乎与"$ Scope"有关,它通常位于.js文件中.

问题是我无法将其他页面的代码加载到.js文件中.Angular的每个例子都只显示如下内容:

function TodoCtrl($scope) {
  $scope.todos = [
    {text:'learn angular', done:true},
    {text:'build an angular app', done:false}];
Run Code Online (Sandbox Code Playgroud)

所以,这很有用,如果IA)想要手动输入所有这些,并且B)如果我事先知道我的所有数据是什么......

我事先不知道(数据是动态的),我不想输入它.

因此,当我尝试使用$ Resource将AJAX调用更改为Angular时,它似乎不起作用.也许我无法弄清楚,但它是一个相对简单的GSON数据的GET请求.

tl:dr我无法让AJAX调用工作,以便将外部数据加载到角度模型中.

javascript ajax model angularjs

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

如果用户拒绝在firefox中共享地理位置,则函数失败从未被调用

所以我有这个javascript代码.在safari和chrome中,如果用户拒绝共享位置,它将失败,因为它应该; 但是,在Firefox中,它没有.

任何帮助赞赏.

function initGeolocation()
{
    if( navigator.geolocation )
    {          
          // Call getCurrentPosition with success and failure callbacks
          navigator.geolocation.getCurrentPosition( success, fail );
    }
    else
    {
          alert("Sorry, your browser does not support geolocation services.");
    }
}

 var map;
 function success(position)
 {

     var longIDText = document.getElementById('longID');
     var latIDText = document.getElementById('latID');
     longIDText.value = position.coords.longitude;
     latIDText.value = position.coords.latitude;
     document.getElementById('coordSubmitID').click();
  }

  function fail(error)
  {
          alert("FAAAAAAAAAAIIIIIIIIIL")
          var zip_code ;
          while (true){
              // Could not obtain location

              zip_code = prompt("Please enter your current address or zip code",""); …
Run Code Online (Sandbox Code Playgroud)

javascript firefox callback geolocation

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

为什么立方体比方形更快

我写了这个:

  var max = 0xffffff * 4;
  var step = 1 / max;
  function cube() {
    var result = 0.;
    for (var x = 0.; x < 1; x += step) {
      result += x * x * x;
    }
    return result;
  }
  function mul() {
    var result = 0.;
    for (var x = 0.; x < 1; x += step) {
      result += x * x;
    }
    return result;
  }
  function go() {
    var r = '';
    r += …
Run Code Online (Sandbox Code Playgroud)

javascript performance

43
推荐指数
2
解决办法
3057
查看次数

如何在JavaScript中将文本转换为二进制代码?

文本到二进制代码

我希望JavaScript将textarea中的文本翻译成二进制代码.

例如,如果用户在TESTtextarea中键入" ",01010100 01000101 01010011 01010100则应返回值" ".

我想避免使用switch语句为每个字符分配二进制代码值(例如case "T": return "01010100)或任何其他类似技术.

这是一个JSFiddle来展示我的意思.这在原生JavaScript中是否可行?

javascript string binary

41
推荐指数
9
解决办法
10万
查看次数

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

JQuery正在更改复选框值,但复选框未显示为已选中

我有一个带有复选框和一些文本的列表(如电子邮件的收件箱).当我单击列表项(行)上的任意位置时,我想检查/取消选中该复选框.我在行的click事件上使用了以下代码:

$(this).find(".cbx input").attr('checked', true);
Run Code Online (Sandbox Code Playgroud)

这是第一次显示选中的复选框.但是当我点击下一次选中它时,复选框的值="已检查"html代码中的更新(我通过firebug检查),但复选框未显示为已选中.

html javascript checkbox jquery

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

地理定位太慢了!我做错了什么?

这是我在测试页面中使用的简单代码:但是找到地址需要很长时间......为什么会这样?难道我做错了什么?

<script src="http://maps.google.com/maps?hl=it&amp;file=api&amp;v=2&amp;sensor=true&amp;key=*xxxxxx*" type="text/javascript"></script>
<script type="text/javascript">
    var map;
    var geocoder;

    function addAddressToMap(response) 
    {
      if (!response || response.Status.code != 200) 
      {
        alert("Sorry, we were unable to geocode that address");
      } 
      else 
      {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);

        document.getElementById('address').innerHTML = place.address;
      }
    }


    function searchGeolocation() 
    {
        if (navigator.geolocation) 
        {
            navigator.geolocation.getCurrentPosition(function(position) 
            {  
                geocoder = new GClientGeocoder();
                document.getElementById('latitude').innerHTML = position.coords.latitude;
                document.getElementById('longitude').innerHTML = position.coords.longitude;
                coordinates = position.coords.latitude+","+position.coords.longitude;
                geocoder.getLocations(coordinates, addAddressToMap);

            }); 
        }else
        {
            document.getElementById('latitude').innerHTML = "Unknown";
            document.getElementById('longitude').innerHTML = "Unknown";
            document.getElementById('address').innerHTML = "Unknown";
            alert("I'm …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps geolocation

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

默认CSS覆盖媒体查询

我从Chrome ADB插件中获取此信息,通过USB连接到我的手机.基本上允许我检查我的android chrome上的元素,并在我连接的PC上查看或更改它们.

我遇到了这个奇怪的问题.我认为媒体查询会否决泛型类规则,但如果您看到此图像,则可以看到媒体查询规则被覆盖.我可以通过添加来解决这个问题!important但我宁愿不这样做,我也意识到非媒体查询容器h1的规则是在媒体查询规则之后声明的.我不确定这是为什么,或者是否还有其他原因.任何人都可以解释为什么会这样吗?

在此输入图像描述

CSS代码:

@media screen and (max-device-width: 767px) {
  .container > h1 {
    font-size: 40px;
    line-height: 40px; }
    ...some more rules... }
.container > h1 {
    margin: 0;
    font-size: 80px;
    font-weight: 300;
    line-height: 80px; }
Run Code Online (Sandbox Code Playgroud)

编辑 - 添加示例

请参阅:http ://jsfiddle.net/djuKS/ 请注意,如果您交换规则顺序,则行为符合预期.但默认情况下,媒体查询被覆盖

css css3 media-queries

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