小编Ser*_*ite的帖子

更改在 IE 11 中不起作用的 DIV 的旋转速度,使用 JS 更新 CSS 动画属性

我正在尝试使用简单的按钮更改 DIV 的旋转速度。它适用于 Chrome,但不适用于 IE。这是IE的限制吗?

var speed = 3;
document.getElementById("speedText").innerHTML = speed + "s";

function changeSpeed(change) {
  speed = speed + change;
  document.getElementById("speedText").innerHTML = speed + "s";
  document.getElementById("rotationDiv").style.animationDuration = speed + "s";
  $("#rotationDiv").load(location.href + " #rotationDiv");
}
Run Code Online (Sandbox Code Playgroud)
#rotationDiv {
  width: 200px;
  height: 200px;
  background-color: blue;
  animation-name: spin;
  animation-duration: 3s;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="rotationDiv"></div>
<p id="speedText"></p>
<button id="button1" onclick="changeSpeed(-1)">Speed Up</button>
<button id="button2" …
Run Code Online (Sandbox Code Playgroud)

html javascript css internet-explorer

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

折叠导航栏立即关闭

我最近几天一直在学习bootstrap 3和sass.无论如何,当屏幕尺寸低于1000px时,我正试图让导航栏崩溃.它可以工作,但当我点击切换按钮,显示菜单下拉菜单时,它会打开,然后立即关闭.

这是代码:http://jsbin.com/zahatekisa/edit?html,css,output

.navbar {
  background-color: #202C39;
}
div.navbar-header a.navbar-brand {
  font-family: "Caveat Brush";
  margin-right: 20px;
  font-size: 23px;
  color: #F29559;
}
div.navbar-header a.navbar-brand:hover {
  color: #ffb36b;
}
ul.nav.navbar-nav li a {
  font-family: "PT Sans", "cursive";
  color: #e6e6e6;
}
ul.nav.navbar-nav li a:hover {
  color: #ffffff;
  background-color: #2a394a;
}
ul.navbar-right li p.navbar-text {
  display: block;
}
@media (max-width: 1050px) {
  ul.navbar-right li a {
    float: left;
  }
  ul.navbar-right li p.navbar-text {
    margin-left: 15px;
    position: relative;
    top: -4px;
  }
} …
Run Code Online (Sandbox Code Playgroud)

css toggle navbar twitter-bootstrap

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

具有固定定位的Bootstrap折叠

我有一个Bootstrap按钮,当单击时,会显示一个从页面顶部开始的div.这是一个精炼的搜索菜单.这个div在顶部有一个条形(精简标题),即使用户向下滚动,我仍希望保持固定.该div的其余部分(精简菜单)应该是可滚动的,但仍然是实际网页的顶部.现在,细化菜单与页面合并.如果我向上滚动页面,精炼菜单会隐藏在精炼标题下方.

在下图中,您可以看到它从左侧图片开始.但是当我向上移动页面时,菜单是精简标题下方的标题,如右图所示.

在此输入图像描述

这是一个Bootply.如您所见,当您完全向下滚动并单击触发按钮时,在向上滚动之前,您甚至看不到细化菜单!

另外,这是我的界面的这部分的相关代码:

#mobile-filter-trigger {
  margin-bottom: 10px;
  padding: 10px 12px;
}
#refine-header {
  position: fixed;
  top: 0;
  z-index: 10000;
  background-color: #27402a;
  color: #fff;
  padding: 6px 15px;
}
#refine-header .btn-default {
  width: 50%;
}
#refine-header > .row > div:first-child {
  padding-top: 7px;
}
#refine-mobile.collapsing {
  z-index: 10000;
  width: 100%;
  background-color: #ffffff;
}
#refine-mobile.collapse.in {
  display: block;
  z-index: 10000;
  top: 0;
  left: 0;
  width: 100%;
  background-color: #ffffff;
}
#refine-accordion .panel-heading {
  padding: 10px 10px;
  background-color: #ffffff;
  border-radius: 0;
} …
Run Code Online (Sandbox Code Playgroud)

html css twitter-bootstrap

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

.click函数在ajax POST中不起作用

我有两个在我的页面上运行的脚本,它们可以独立工作,但不能一起工作.脚本的第一部分是ajax POST,它根据搜索从我的数据库中选择行.这都是在模态窗口中呈现的.第二个脚本等待.btnSave id中的单击,关闭模式窗口并将id的值复制到表的最后一行.

两个javascript文件一起是:

$(document).ready(function()
{

$('.btnSave').click(function() {
        alert();
var value = this.id;

$('#tablemain tbody tr:last #itemlookup').val(value);
$('#tablemain tbody tr:last #itemlookup').focus();
$('#productlookup').modal('hide');
});


$("#simple-post").click(function()
{
$("#ajaxform").submit(function(e)
{

    var postData = $(this).serializeArray();

    $.ajax(
    {
        url : "ajax.php",
        type: "POST",
        data : postData,
        success:function(data) 
        {
            $("#simple-msg").html(data);

        }

    });
    e.preventDefault(); //STOP default action

});

$("#ajaxform").submit(); //SUBMIT FORM
});

});
Run Code Online (Sandbox Code Playgroud)

主要的PHP文件包括模态窗口:

<div id="productlookup" class="modal fade" role="dialog">
      <div class="modal-dialog"> 

        <!-- Modal content-->
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4 class="modal-title">Instant Car Parts Stock …
Run Code Online (Sandbox Code Playgroud)

javascript php ajax jquery

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

Android中BézierPath的SVG路径

我正在研究SVG和Bézier路径.这对我来说很新鲜.我想从SVG Paths制作BézierPathAnimations.要求是为任何形状或字母设置动画,如"A""B""C"及其后.现在我不知道是否可以从一些绘图工具制作SVG路径并将这些路径或文件提供给Android中的Bézier路径(转换)..任何帮助将不胜感激

更新

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);

        View v = new SVGTest(this);

        setContentView(v);

    }
}
Run Code Online (Sandbox Code Playgroud)

android android-animation

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

scrollTop无法在Firefox和IE中运行

我在firefox和IE中的scrolltop有一些问题我在我的代码中使用了scrolltop超过2次它在第一部分它可以工作但在第二部分它不是我有两个箭头"next"和"prev"当点击它们页面滚动到具体部分,我无法找到如何解决它?

jquery:

var lchiled=$("ul#portfolio li").last();
var fchiled=$("ul#portfolio li").first();
$('li.section').first();
$("ul#portfolio li:first-child").addClass("current");

$('a.display').on('click', function(e) {
    e.preventDefault();

    var t = $(this).attr('name');

    that = $(this);


    if (t === 'next') {
        if($('.current').next('.section').length==0)
            var $next = $('li.section').first();
        else
            var $next = $('.current').next('.section');

        var top = $next.offset().top -65;
        $('.current').removeClass('current');

        $('body,html').animate({
        scrollTop: top,
        }, 

        function () {
        $next.addClass('current');
        // alert(top);
        });
    }
    else if (t === 'prev' && $('.current').prev('li.section').length > 0) {
        var $prev = $('.current').prev('.section');
        var top = $prev.offset().top -65;
        $('.current').removeClass('current');

        $('body').animate({
             scrollTop: top,     
        }, function …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

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

C++ - 无法通过引用传递迭代器指向的对象

我有下面的代码片段,一个试图将对set(foo)中的对象的引用传递给另一个函数(goo)的函数.

/**************** working ***************/
{
    std::set<MyStruct> foo;

    MyStruct abc = *foo.begin();
    goo(abc);
}    

int goo(MyStruct & st)
{
    //some code here
}


/**************** not working ***************/
{
    std::set<MyStruct> foo;

    goo( *(foo.begin()) );    
}    

int goo(MyStruct & st)
{
    //some code here
}
Run Code Online (Sandbox Code Playgroud)

和错误列表:

>file.cpp:190:45: error: no matching function for call to 'goo(const MyStruct&)'
>file.cpp:190:45: note: candidate is:
>file.h:33:9: note: int goo(MyStruct&)
>file.h:33:9: note: no known conversion for argument 1 from 'const MyStruct' to 'MyStruct&'
Run Code Online (Sandbox Code Playgroud)

第一个版本编译正常,而第二个版本报告错误.我已经看过const关键字,但我不是在任何地方将const括起来的,而且这个集合不是const.你能解释一下我做错了什么吗?

c++ iterator parameter-passing pass-by-reference

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

网格压缩会提高 Unity3D 游戏的性能吗?

我想知道Unity的网格压缩是否可以提高低端硬件的游戏性能。

网格压缩是否会降低游戏的要求,还是仅对减少文件大小和游戏占用的存储空间有用?

compression mesh unity-game-engine

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

检查禁用的导航网格代理(玩家)是否在导航网格上

我使用播放器上的导航网格/代理作为辅助自动路径功能,其中代理始终处于禁用状态,除非用户单击地板上的某个点走向。然后,一旦到达目的地,代理将再次被禁用。

我需要一种方法来检查玩家当前是否位于导航网格上,在可容忍的阈值内,而无需启用导航网格代理。或者,如果有一种方法可以删除 navmeshagent 的玩家绑定“效果”而不禁用它,因为我也可以用它来解决我的问题。

我想在伪代码中,这就是我试图在禁用 navmeshagent 的情况下完成的任务:

if (!agent.isOnNavMesh){ DisableClickSelection();}
Run Code Online (Sandbox Code Playgroud)

我正在考虑是否可以比较玩家和导航网格的 Y 变换以获得高度差,并使用它来确定玩家是否在导航网格上,但我不知道如何获取导航网格位于特定的 X 和 Z 点。也许我可以使用光线投射?我不确定最好的方法。就像我说的,如果有一种方法可以消除代理对玩家的玩家绑定“效果”,但保持代理启用,我也可以使用它。

unity-game-engine navmesh

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