笙默考试管理系统---dialog

笙默考试管理系统---dialog

目录

笙默考试管理系统---dialog

一、 笙默考试管理系统---dialog

二、 笙默考试管理系统---dialog

三、 笙默考试管理系统---dialog

四、 笙默考试管理系统---dialog

五、 笙默考试管理系统---dialog

  • 笙默考试管理系统---dialog

/**

 * Created with jing.zhao2013

 * Date: 13-11-28

 * Time: 上午10:40

 *    {

 *      cls: "",           //自定义的class样式

 *      closeCls:"",       //关闭按钮的鼠标滑class样式

 *      open:true,         //是否为打开状态

 *      isModal:false,     //是否模态窗口

 *      isDrag:false      //是否可拖动

 *    }

 */

(function($){$.fn.extend({"dialog":function(options){

    var ops = $.extend({

        cls: "",

        closeCls:"",

        open:true,

        isModal:false,

        isDrag:false,

        btn:[]

},options);

  • 笙默考试管理系统---dialog

    var $dom = $(this),

        $shadow = $("

"),

        $win = $(window);

    if(!$dom.get(0)) return;

    var dialog = {

        render:function(){

            $dom.addClass(ops.cls);

            $dom.css("z-index","10000");

            if(ops.isModal){

                this.showShadow();

            }

  • 笙默考试管理系统---dialog

            if(!ops.open){

                $dom.hide();

                if(ops.isModal){$shadow.hide();}

            }

            var $close = $dom.find(".dialog-close-button");

            if($close.get(0)){

                $close.bind({

                    'click':function(e){if(ops.isModal){$shadow.hide();}$dom.hide();e.stopPropagation();},

  •   笙默考试管理系统---dialog

                  'mouseover':function(e){$(this).addClass(ops.closeCls);e.stopPropagation();},

                    'mouseout':function(){ $(this).removeClass(ops.closeCls);},

                    'mousedown':function(e){e.stopPropagation();}

                });

            }

            if(ops.isDrag){

                this.dragndrop();

            }

        },

        showShadow:function(){

            var h = Math.max($win.innerHeight(),$("body").innerHeight());

            Var

  • 笙默考试管理系统---dialog

 w = Math.max($win.innerWidth(),$("body").innerWidth());

            $shadow.css({height:h,width:w});

            $("body").append($shadow);

        },

        dragndrop:function(){

            var $title = $dom.find(".dialog-top");

            var startX,startY,startLeft,startTop,dragging = false;

            var maxLeft = $win.innerWidth()-$dom.outerWidth();

            var maxTop = $win.innerHeight()-$dom.outerHeight();

            var fn={

                down:function(e){

                    dragging = true;

                    $title.css('cursor','move');

                    startX = e.pageX;

                    startY = e.pageY;

                    startLeft=$dom.offset().left;

                    startTop=$dom.offset().top;

                    e.stopPropagation();

                },

你可能感兴趣的:(笙默考试管理系统,javascript,开发语言,ecmascript)