zoukankan      html  css  js  c++  java
  • [orginal]Toolbar control based on web design


    abstract : toolbar is one of the most important controls for design  desktop ,web interface. today we try to explain how to create toolbar  from ABC .

     with nice look body, easy to control and invoking.

    physically: the toolbar is container that hold other element such image ,text or even more complex control like list,combox  with in inline display ,

    from html point of view we can say  each element of the toolbar is LI ,the toolbar it'self is UL. it is not easy as i said  we will see more below .

    logically: we  will see the three logic basic aspects for the toolbar  that is css,js,and html.

    css:

     

    /*ul*/

    .Toolbar

    {

        width
    :600px;

        height
    :64px;

        position
    :absolute;

        border
    :1px #C1C5CD solid;

        list-style
    :none;

        background-repeat
    :repeat-x;

        margin
    :0px;

        padding
    :0px 0px 0px 0px;

        

    }



    .ToolbarItem

    {

        display
    :inline;

        margin-left
    :0px;

        margin-top
    :0px;

        width
    :auto;

        height
    :inherit;

        position
    :static;

        color
    :black;

        float
    :left;

        cursor
    :default;

        position
    :absolute;

    }





    .toolbarItemBurron

    {

        position
    :absolute;

        cursor
    :default;

        background-repeat
    :no-repeat;

      

    }



    /*button caption*/

    .toolbarItemBurron .toolbarItemCaption

    {

        cursor
    :default;

        text-align
    :center;

        margin-left
    :0px;

        margin-top
    :0px;

        position
    :absolute;

        font-family
    : 宋体;

        font-size
    : 12px;



    }




    JS: 

     from js point of view  we consider how to create the toolbar auto-code  that is to mean the user will not asked to create html code , the js here to accomplish all these functions , below we go with more details  starting from the toolbar items .

     Toolbar Item:

    1- create the item in js code : 

    here enable the function to create js element and tags dynamically  for each element with dynamically naming 


     function ToolbarItemCode(parent)

    {

      
    var div=document.createElement('div'); // the border

          div.id
    =parent+'tbItem';

          div.className
    ='toolbarItemBurron';

      
    var pa=document.getElementById(parent);

          pa.appendChild(div); 



     

    2- class of the toolbar item :

    here we go the toolbar item as object mean  the class of the toolbar item that is to say each element in the toolbar is an entity that is different  from other elements.

    here is the class with most important methods and properties as you will see , all these  methods provide practical way to control the items of the tab independently ,also provide dynamic layout for each item.

    // the class of the toolbar item

    Code

     toolbar:

    after  we write the code for each item of the toolbar , just need to invoke it here , the toolbar is also object that contain methods and properties each one has it's own flavor :

    we start  by creating the html code dynamically using js as below :

    Code

    here is class object:

    Code

    the last step is how to create toolbar with multiple items , here we go the html code :

    1-put the headers in the head part of html: 

    <link rel="stylesheet" type="text/css" href="ToolBar.css"/>

    <script language="javascript" type="text/javascript" src="ToolBar.js"></script>

    2-add only one html line code that is where to put the toolbar

     

     <div id="pid"></div> 

    2- call the js object

     as you will we consider two aspects when we invoke the toolbar object , first the toolbar itself second the items.

    we create a toolbar in the 'pid' tag , the toolbar has 700 px width   and 64 px height , 6 items are in the toolbar , each has it's won caption  with dynamic name and layout:

    Code

      

     

     thanks

    Ammar Hawbani  

      

  • 相关阅读:
    QTableView表格控件区域选择-自绘选择区域
    Qt高仿Excel表格组件-支持冻结列、冻结行、内容自适应和合并单元格
    QRowTable表格控件(三)-效率优化之-合理使用QStandardItem
    QRowTable表格控件(二)-红涨绿跌
    QRowTable表格控件-支持hover整行、checked整行、指定列排序等
    Qt实现表格控件-支持多级列表头、多级行表头、单元格合并、字体设置等
    Asp.net MVC利用Ajax.BeginForm实现bootstrap模态框弹出,并进行前段验证
    Bootstrap:弹出框和提示框效果以及代码展示
    Bootstrap treeview增加或者删除节点
    bootstrap-treeview 如何实现全选父节点下所有子节点及反选
  • 原文地址:https://www.cnblogs.com/ammar/p/1590807.html
Copyright © 2011-2022 走看看