相关疑难解决方法(0)

检查,如果元素是div

我如何检查是否$(this)div,ulblockquote

例如:

if ($(this) is a div) {
  alert('its a div!');
} else {
  alert('its not a div! some other stuff');
}
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

59
推荐指数
6
解决办法
7万
查看次数

Google Closure使用this关键字绑定/解决问题

什么是Google Closure解决thisJavaScript回调函数中关键字问题的解决方案.它在OO风格编程中非常有用.

Google Closure中是否存在OOP的约定或样式?

更新 如何在ViewportSizeMonitor处理程序中访问this.darklayer ???

    goog.require('goog.dom');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('goog.math.Size');
goog.require('goog.style');

goog.require('goog.dom.ViewportSizeMonitor');

goog.provide('ehsun7b.ajax.AjaxBox');

ehsun7b.ajax.AjaxBox = function (url, containerClass) {
  try {
    this.url = url;
    this.containerClass = containerClass;

    var viwportSize = goog.dom.getViewportSize();
    this.darklayer = goog.dom.createDom("div", {
      "style": "width: " + viwportSize.width + "px;" + "height: " + 
      viwportSize.height + "px;" +
      "background-image: url('css/img/50black.png');" +
      "z-index: 1000;" +
      "position: absolute;" +
      "left: 0px; top: 0px;"
    });

    var vsm = new goog.dom.ViewportSizeMonitor(); …
Run Code Online (Sandbox Code Playgroud)

javascript oop bind this google-closure-library

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

标签 统计

javascript ×2

bind ×1

css ×1

google-closure-library ×1

html ×1

jquery ×1

oop ×1

this ×1