My question might be a bit vague but here's what I have right now. Here's the fiddle I did

我的问题可能有点含糊,但这是我现在的问题。这是我做的小提琴

I need the More button to change background color to orange every time the orange background button is clicked and only if the More div is still at the bottom of the screen (The MORE button slides up when it's clicked)

每次点击橙色背景按钮时,我需要更多的按钮来将背景颜色改为橙色,而且只有当div越长时,它才会显示在屏幕的底部(点击时,会有越多的按钮出现)

And some snippet of my code:

我的代码片段:

<script>

$(document).ready(function(){
 $('.chatbox').hide();
    $('#btn-chat').click(function() {
        $("#blk-collaboration .chatbox").slideToggle("slow",function(){
        $("#blk-collaboration #toggle").css("background","transparent");
    });
      $(this)//this is a button DOM element. wrapping in jQuery object.
      .toggleClass('wide'); // removing wide class so button became smaller.
    });
});

function changeColor(color) {
document.getElementById("circle").style.backgroundColor = color;
}

document.getElementById("online").onclick = function() { changeColor("#92bf1e"); }
document.getElementById("offline").onclick = function() { changeColor("#747474"); } 
document.getElementById("upcoming").onclick = function() { changeOrange("#f4b066"); } 



</script>

Here are the buttons...

这是按钮……

<input id="online" type="button" value="Online" />
<input id="offline" type="button" value="Offline" />
<input id="upcoming" type="button" value="Orange Background" />

Been trying to figure this out but the color of the more button still changes even if it's already slided up...

试着找出答案,但是按钮的颜色仍然会改变,即使它已经被滑动了…

4 个解决方案

#1


1

This should to do it, add this below the changeColor function:

应该这样做,把它添加到changeColor函数下面:

function changeOrange(color) {
 if ($('#btn-chat').hasClass('wide'))
     document.getElementById("btn-chat").style.backgroundColor = color;
}

If the background is already orange, and the more button moves up, should the background change back to blue?

如果背景已经是橙色的,按钮越往上移动,背景是否应该重新变为蓝色?

更多相关文章

  1. 如何检索类以隐藏按钮?
  2. 获取背景图像的最终大小
  3. Jquery禁用/启用按钮与文本框代码
  4. js和jquery使按钮失效为不可用状态的方法
  5. fullcalendar.js - 在按钮点击时删除事件
  6. 如何让代码等待好/取消按钮选择?
  7. 谷歌地图信息窗口按钮没有显示?
  8. 在使用kendo网格中的删除按钮后,如何刷新MVC中的部分视图
  9. jquery 插件bgStretcher 切换背景图片

随机推荐

  1. Ruby如何创建数组
  2. ASP是什么
  3. c语言怎么输出字符串
  4. ASP.NET与.NET的区别是什么
  5. IO帮助类是什么?IO帮助类的实例介绍(附代码
  6. ASP.NET与ASP有什么不同
  7. 什么是XML序列化?XML序列化实例介绍(附代码
  8. asp.net是什么
  9. 字符如何操作普通帮助类?字符操作普通帮助
  10. C语言是什么