小编use*_*061的帖子

html 中的工具提示

我有一个需要使用线和框(将包含一条消息)识别的 div,如下面的模型图像所示。 2 和 3(线和矩形框)彼此固定并且可拖动和 1(线)可以向任何方向拉伸。我已经创建了这个盒子,但我不知道如何在它上面附加一条线。这是我尝试过的。

JSFIDDLE

js

const $b1 = $("#box1");
const $b2 = $("#box2");
const $line = $("#line");

const coordinates = function() {
debugger;
  const x1 = $b1.offset().left;
  const y1 = $b1.offset().top + $b1.height()/2;
  const x2 = $b2.offset().left + $b1.width()/2;
  const y2 = $b2.offset().top + $b1.height()/2;

  moveLine(x1, y1, x2, y2);  
}

coordinates();

function moveLine(x1, y1, x2, y2) {
    var length = Math.sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
    var angle …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery plugins

9
推荐指数
2
解决办法
421
查看次数

调用类的方法而不创建它的对象

class A{
    String z(){
        System.out.println("a");
        return "sauarbh";
    }
}
class B{
    A a;
    A x(){
    return a;   
    }
}
public class runner {
    public static void main(String[] args) {
        B b = new B();
        A a2=b.x();
        a2.z(); // Calling A class method without creating object of it
    }
}
Run Code Online (Sandbox Code Playgroud)

另一个例子

class Person
   {
   private String lastName;
   private String firstName;
   private int age;
//--------------------------------------------------------------
   public Person(String last, String first, int a)
      {                               // constructor
      lastName = last;
      firstName = first;
      age …
Run Code Online (Sandbox Code Playgroud)

java

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

标签 统计

html ×1

java ×1

javascript ×1

jquery ×1

plugins ×1