-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


[ ] jQuery jdDialog.

, 27 2017 . 17:11 +


. , . .

.

, :

  • jQuery 1.9,
  • ,
  • 2-3 ,
  • confirm alert.

Google. , ..

if(confirm('') ) {...}

, ( Dialog UI).

:

  • ,
  • ,
  • , html- .

, ?

:

  • .
  • .
  • ( ).
  • .
  • .

jQuery, , .


.

:

  • ,
  • ,
  • ,
  • .

, . - , .

, .. , . 2 . - . , - , .

, , :

  • ,
  • , - , , .

DOM, data-, .data().

- .

jQuery.
.

:

1)

.. , . .

id . . , id , , .. ( ). id .

- , , id . 1,2, .

2)

. .

:

( jdReclick). . , - :

  1. - ,

3)

. , .

:

  • .
  • , - .

:

  • .
  • .
  • . , , . id , 0 . , .. , , .


- - :

$('#test').click(function() { ...

:

$(this).jdDialogs('confirm',1,['?',''],fncname)

, this,
:

1 ( ),
2 id
3
4

:


if(! $(this).jdDialogs('confirm',1,['?','']) ) return;

if( $(this).jdDialogs('confirm',1,['?','']) ) {
...
}

switch( $(this).jdDialogs('confirm',1,['?','']) ) {
 case 1: ...;
 default: return;
}

Alert , return, return .


$(this).jdDialogs('alert',0,['!','Project'])


if(! $(this).jdDialogs('alert',0,['!',project]) ) return;
alert(' ');

confirm, alert, cnf, al . .

jdDialog, :

  • jdGetWin
  • id jdCheckId

/ case , return .

. alert 2 jdClose0 jdClose1 . jdGetWin switch case.

jdSetAnswer. id id - . id , id .

$(id).data(fname,value);

.detach() fadeIn 10

$('.jdModalBg').detach().fadeIn(10,function() {	

: . 4- , .

if(!!fncdo) window[fncdo]();

. ID . .. .

methods.jdReclick(id);

.

-


1. data 2 : .

$(this).jdDialogs('confirm2bttn',0,['  ','  3',' ',' '])

.

2. :

	confirm2bttn : function(fid,data,fname) {
		return methods.jdDialog('Confirm2bttn',fid,data,$(this),fname);
		}	

3. . , :

case 'Confirm2bttn':
	var bttntext1 = data[2];
	var bttntext2 = data[3];
	jdBttns = ''+
			 ''+
			 '';
	clClass = 'jdClose0';
break;

4. Ok2 .jdOk2 2:

	.on('click','.jdOk2', function() {			
		methods.jdSetAnswer(2,$(this));
		})

5. - :

switch($(this).jdDialogs('confirm2bttn',0,['  ','  3',' ',' '])) {
	case 0: return;
	case 1:
		alert(' ');
	break;
	case 2:
		alert(' ');
	break;
	default:

6. , . - :

.jdDialogConfirm2bttn {
	min-width:380px;
	max-width:450px;
	}
.jdDialogConfirm2bttn .jdText {
	min-height:60px;
	}	
.jdDialogConfirm2bttn .jdHeader{
	background-color: hsl(115,63%,15%);
	color:#F0C800;
	}
.jdDialogConfirm2bttn .jdHeader .jdClose{
	background-color: hsl(114,58%,22%);
	color:#F5DA50;
	}

, , . jQuery . jQuery 1.9, 3.2.1.
Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/331770/

:  

: [1] []
 

:
: 

: ( )

:

  URL