Sunday, 3 March 2013

kk




#wrapper {
width:600px;
margin:0 auto;
border-radius:0 0 5px 5px;
-moz-border-radius:0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
background:#fff;
border:1px solid #ccc;
padding:25px;
border-top:none;
box-shadow:0 0 5px #ccc;
-moz-box-shadow:0 0 5px #ccc;
-webkit-box-shadow:0 0 5px #ccc;
text-align:left;
}
#lightbox {
position:fixed; /* keeps the lightbox window in the current viewport */
top:0;
left:0;
width:100%;
height:100%;
background:url(overlay.png) repeat;
text-align:center;
    z-index:9999;
}
#lightbox p {
text-align:right;
color:#fff;
margin-right:20px;
font-size:12px;
}
#lightbox img {
box-shadow:0 0 25px #111;
-webkit-box-shadow:0 0 25px #111;
-moz-box-shadow:0 0 25px #111;
max-width:600px;
    border:solid 5px #ffffff;
}

#lightbox #closeDiv #closeImg
{
    width:20px;height:20px;background-color:red;float:right;
}

#lightbox #closeDiv
{
    width:600px;
}

*********************************************************

jQuery(document).ready(function($) {
    
$('.Lightbox').click(function(e) {
//prevent default action (hyperlink)
e.preventDefault();
//Get clicked link href
var image_href = $(this).attr("href");
         
        $('body').append('<div id="lightbox" style="display:none"><div id="closeDiv"><div id="closeImg"></div></div><div id="lightBoxImg"></div></div>');
        
/*
If the lightbox window HTML already exists in document, 
change the img src to to match the href of whatever link was clicked
If the lightbox window HTML doesn't exists, create it and insert it.
(This will only happen the first time around)
*/
  if ($('#lightBoxImg').html().length > 0) { // #lightbox exists
//place href as img src value
$('#lightBoxImg').html('<img src="' + image_href + '" />');
//show lightbox window - you could use .show('fast') for a transition
   $('#lightbox').fadeIn();
}
else { //#lightbox does not exist - create and insert (runs 1st time only)
//create HTML markup for lightbox window
var lightboxContent = '<img src="' + image_href +'" />';
 
           
//insert lightbox HTML into page
$('#lightBoxImg').html(lightboxContent);
            $('#lightbox').fadeIn();
}
});
//Click anywhere on the page to get rid of lightbox window
$('#lightbox').live('click', function() { //must use live, as the lightbox element is inserted into the DOM
$('#lightbox').hide();
});

});

*******************************HTML****************

  
   var LightBox = true;
   if (LightBox) {
       this.data.html = this.data.html.replace("<a ", "<a class='Lightbox'");         
   }
   editor.selection.setContent(this.data.html);

No comments:

Post a Comment