美文网首页
面向对象第一次伟大尝试(失败)

面向对象第一次伟大尝试(失败)

作者: 毕子歌 | 来源:发表于2017-03-31 19:38 被阅读0次
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<ul id=ct>
  <li class = list id='list1'>珠宝玉器<span>></span></li>
  <li class = list id='list2'>珠宝玉器<span>></span</li>
  <li class = list id='list3'>珠宝玉器<span>></span</li>
  <li class = list id='list4'>珠宝玉器<span>></span</li>
  <li class = list id='list5'>珠宝玉器<span>></span</li>
</ul>
</body>
</html>
*{padding :0;margin:0;font-family:微软雅黑,Arial; }
li{list-style: none}
#ct{
  margin : 10px;
  max-width : 15em;
  background: #e12;
  
}
.list{
  position:relative;
  font-size:1.1em;
  color:#fff;
  margin:0 0.5em;
  padding:0.5em 0.5em;
  border-top:0.2px dotted rgba(200,200,200,0.5) ;
  cursor : pointer;
  vertical-align: middle; 
}
.list:first-child{border:0}
.list>span{
  position:relative;
  left:6em;
  font-size : 1.2em;
}
.list2{
  position:absolute;
  left:15em;
  border:1px solid;
}
  this.seats = seats
  this.prepareHtml()
  this.mount()
  this.close()
}


 items.prototype.prepareHtml = function(){
  var {seat1,seat2,seat3,seat4}= this.seats
  var div = this.div =document.createElement('div')
  div.className = 'list2'
  var html =`
      <div>${seat1}</div><div>${seat2}</div>
      <div>${seat3}</div><div>${seat4}</div>
` 
   div.innerHTML = html

  
   }
 items.prototype.mount = function(){
   $('#ct').append(this.div)
}
 items.prototype.close = function(){
  var xxx = this.div
  $('.list').mouseleave(function(){ xxx.remove()})

}




 $('.list').mouseenter(function(){
  var secondList = new items({
    seat1 : '翡翠',
    seat2 : '玉石',
    seat3 : '宝石',
    seat4 : '水晶',
    seat5 : '玛瑙',
    seat6 : '珍珠'
  })
  

 }) 

相关文章

  • 面向对象第一次伟大尝试(失败)

  • 第一章 为什么需要UML

      面向对象的精髓在抽象;面向对象的困难在抽象;面向对象的成功在于成功的抽象;面向对象的失败在于失败的抽象。  对...

  • 阿里编程规约之OOP规约

    “面向对象的精髓在抽象,面向对象的困难在抽象,面向对象的成功在于成功的抽象,面向对象的失败在于失败的抽象。正所谓成...

  • numpy实现朴素贝叶斯模型(高斯分布)

    第一次尝试用面向对象的方式构建函数,写了一个GaussianNB类,完善了拟合、预测函数。

  • 2019-03-03

    Python面向对象编程 [图片上传失败...(image-ec12f-1572616533215)] 本节课纲 ...

  • 类和对象

    在第一次听到“面向对象“这四个字,大家或许多少都感到有些不知所措,感觉像是玄学。到底什么是面向对象,面向对象有什么...

  • PHP全栈学习笔记8

    面向对象的基本概念,面向对象编程,oop,面向对象,面向对象的分析,面向对象的设计,面向对象的编程,什么是类。 类...

  • PHP全栈学习笔记8

    面向对象的基本概念,面向对象编程,oop,面向对象,面向对象的分析,面向对象的设计,面向对象的编程,什么是类。 类...

  • Python标准异常总结

    AssertionError 断言语句(assert)失败 AttributeError 尝试访问未知的对象属...

  • Python标准异常总结

    AssertionError 断言语句(assert)失败AttributeError 尝试访问未知的对象属性...

网友评论

      本文标题:面向对象第一次伟大尝试(失败)

      本文链接:https://www.haomeiwen.com/subject/bmwvottx.html