• SLibSElement元素操作


            function SElement(eleId){
               var self = SLib.getElement(eleId);
               this.getElement = function (){
                                     return self;
                                 }
               this.getXY = function () {
                                return SLib.getXY(self);
                            }
               this.getX =  function () {
                               return  SLib.getXY(self)[0];
                            }
               this.getY = function () {
                                return  SLib.getXY(self)[1];
                            }
               this.setXY =  function (x,y){
                             self.style.left = x+"px";
                             self.style.top = y +"px";
                             }
               this.setX = function (x) {
                           self.style.left = x+"px";
                           }
               this.setY = function (y) {
                           self.style.top =  y +"px";
                           }
               this.getStyle = function(s){
                                   return self.style[s];
                               }
               this.setStyle = function(s,value){
                                    self.style[s] =value;
                               }
               this.getWidth = function(){
                                    return self.offsetWidth;
                               }
               this.getHeight = function(){
                                    return self.offsetHeight;
                                }
               this.getAttribute =function (s){
                                    return self.getAttribute(s);
                                  }
               this.getRectangle = function(){
                                       return [this.getWidth(),this.getHeight()];   
                                   }
               this.alignTo = function(ele,direction){
                                   var l = ele.getX();
                                   var t = ele.getY();
                                   var w = ele.getWidth();
                                   var h = ele.getHeight();
                                   switch(direction){
                                      case "lt" :this.setX(l);
                                                 this.setY(t);
                                                 break;
                                      case "lb" :this.setX(l);
                                                 this.setY(t+h);
                                                 break;
                                      case "rt" :this.setX(l+w);
                                                 this.setY(t);
                                                 break;
                                      case "rb" :this.setX(l+w);
                                                 this.setY(t+h);
                                                 break;
                                         default:break;
                                   }
                          
         
                           }
             
        }
  • 相关阅读:
    C++ 11 右值引用以及std::move
    poj2299--B
    Linux Socket编程注意事项
    Using Qt to build an Omi App for iOS (and Android)
    openwrt 3g模块上网
    详谈隐藏Tabbar的几种方法
    ZOJ 3529 A Game Between Alice and Bob(博弈论-sg函数)
    uva 10574
    【MySQL案例】HA: GTID_MODE配置不一致
    Swift UIView 层次调整
  • 原文地址:https://www.cnblogs.com/swneng/p/1304886.html
Copyright © 2020-2023  润新知