jQuery 弹出层 弹出对话框
jQuery 弹出层 弹出对话框
可以设置大小,ajax内容弹出,背景等各种调整
XML/HTML Code
- <div id="wrapper">
- <section>
- <div class="container_6 clearfix">
- <section class="main-section grid_6">
- <div class="main-content">
- <section class="clearfix">
- <div>
- <input id="alert" type="button" class="flat bgFix" value="alert('Hello!')" />
- <input id="ajax" type="button" class="flat bgFix" value="Ajax Content" />
- <input id="buttons" type="button" class="flat bgFix" value="Buttons" />
- <input id="small" type="button" class="flat bgFix" value="Small" />
- <input id="draggable" type="button" class="flat bgFix" value="Draggable" />
- <br />
- <br />
- <input id="wbgf" type="button" class="flat bgFix" value="White Fading Background" />
- <input id="bbgf" type="button" class="flat bgFix" value="Black Fading Background" />
- <br />
- <input id="bbg" type="button" class="flat bgFix" value="Black (or white!) Background" />
- <input id="nobg" type="button" class="flat bgFix" value="No Background" />
- <br />
- <input id="center" type="button" class="flat bgFix" value="Centered on Resize" />
- <script>
- $(document).ready(function() {
- ClassyLightbox.init({
- override:true,
- background: 'white',
- centerOnResize: true,
- fade: true
- });
- $('#alert').click(function() {
- alert('Hello');
- });
- $('#hello').click(function() {
- alert('Hello there, my name is ClassyLightbox. Pleasure meeting you.');
- });
- $('#ajax').click(function() {
- ClassyLightbox.alert({
- width: '400px',
- title: 'Ajax Content',
- rightButtons: ['OK'],
- leftButtons: ['Close'],
- opened: function() {
- $('<span />').load('demo.html').appendTo('#lbContent');
- },
- onClick: function(button) {
- console.log(button);
- }
- });
- });
- $('#buttons').click(function() {
- ClassyLightbox.alert({
- width: '400px',
- title: 'Button Callbacks',
- rightButtons: ['No', 'Yes'],
- leftButtons: ['Close'],
- opened: function() {
- $('<span />').html("rightButtons: ['No', 'Yes'],<br />leftButtons: ['Close']<br />").appendTo('#lbContent');
- },
- onClick: function(button) {
- if (button != 'Close') {
- $('#ClassyLightbox #lbContent').append('<br />Clicked '+button);
- }
- console.log(button);
- }
- });
- });
- $('#small').click(function() {
- ClassyLightbox.alert({
- width: '200px',
- title: '200px',
- rightButtons: ['OK'],
- opened: function() {
- $('<span />').html("I am Small. <br />width: '200px',").appendTo('#lbContent');
- },
- onClick: function(button) {
- console.log(button);
- }
- });
- });
- $('#draggable').click(function() {
- ClassyLightbox.alert({
- width: '400px',
- title: 'Drag Me Up Here!',
- rightButtons: ['Cool!'],
- opened: function(){
- $('<span />').html("If jQuery UI is loaded, all windows will become draggable automagically!").appendTo('#lbContent');
- },
- onClick: function(button) {
- console.log(button);
- if (button == 'Cool!') {
- ClassyLightbox.clear();
- }
- }
- });
- });
- $('#wbgf').click(function() {
- ClassyLightbox.destroy();
- ClassyLightbox.init({
- override:true,
- background: 'white',
- centerOnResize: false,
- fade: true
- });
- alert("Hello World");
- });
- $('#bbgf').click(function() {
- ClassyLightbox.destroy();
- ClassyLightbox.init({
- override:true,
- background: 'black',
- centerOnResize: false,
- fade: true
- });
- alert("Hello World");
- });
- $('#bbg').click(function() {
- ClassyLightbox.destroy();
- ClassyLightbox.init({
- override:true,
- background: ((Math.ceil(Math.random()*2))==2) ? 'white' : 'black',
- centerOnResize: false,
- fade: false
- });
- alert("My background doesn't have to fade in, it can be distracting at times.");
- });
- $('#nobg').click(function() {
- ClassyLightbox.destroy();
- ClassyLightbox.init({
- override:true,
- background: 'none',
- centerOnResize: true,
- fade:false
- });
- alert("I have no background");
- });
- $('#center').click(function() {
- ClassyLightbox.destroy();
- ClassyLightbox.init({
- override:true,
- background:'white',
- centerOnResize: true,
- fade: false
- });
- alert("Resize the window when I am open! I stay centered on resize.");
- });
- });
- </script>
- </div>
- </section>
- </div>
- </section>
- </div>
- </section>
- </div>
相关推荐
周公周金桥 2020-09-06
大象从不倒下 2020-07-31
AlisaClass 2020-07-19
MaureenChen 2020-04-21
xingguanghai 2020-03-13
teresalxm 2020-02-18
木四小哥 2013-05-14
SoShellon 2013-06-01
Simagle 2013-05-31
羽化大刀Chrome 2013-05-31
waterv 2020-01-08
LutosX 2013-07-29
vanturman 2013-06-27
wutongyuq 2013-04-12
luoqu 2013-04-10
today0 2020-09-22
89520292 2020-09-18
bigname 2020-08-25