在某一个页面中需要控制body的样式{overflow:hidden}为这个 这样写的this.$("body").css("overflow","hidden"); 如果直接获取body的某个样式,显示的是undefined
这是为什么
xieyiClick : function(e) { var $checkbox = this.$("#checkbox-xieyi"); if ($checkbox.prop("checked")) { this.error(); this.$("#btn-register").removeAttr("disabled"); this.$(".screen").css({"display":"block"}); this.$("body").css("overflow","hidden"); this.$(".user_book").css("display","block"); } else { this.error("show", "请先仔细阅读注册协议并选择同意."); this.$("#btn-register").attr("disabled", ""); } },
其实我只是在一个页面中设置body的样式为overflow:hiden 因为现在是点击出现一个弹框 同样我需要页面不能滑动
你的this指向的是当前的backbone的view实例,跟body一点关系都没有。
操作body可以直接使用$("body")
因为你没有在body标签的style属性中写入样式啊