Advertisement
Guest User

script.js

a guest
Oct 11th, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function() {
  2.  
  3. $('a.poplight[href^=#]').click(function() {
  4.     var popID = $(this).attr('rel'); //Trouver la pop-up correspondante
  5.     var popURL = $(this).attr('href'); //Retrouver la largeur dans le href
  6.  
  7.     //Récupérer les variables depuis le lien
  8.     var query= popURL.split('?');
  9.     var dim= query[1].split('&');
  10.     var popWidth = dim[0].split('=')[1]; //La première valeur du lien
  11.  
  12.     $('#' + popID).fadeIn().css({
  13.         'width': Number(popWidth)
  14.     })
  15.     .prepend('');
  16.  
  17.     var popMargTop = ($('#' + popID).height() + 80) / 2;
  18.     var popMargLeft = ($('#' + popID).width() + 80) / 2;
  19.  
  20.     $('#' + popID).css({
  21.         'margin-top' : -popMargTop,
  22.         'margin-left' : -popMargLeft
  23.     });
  24.  
  25.     $('body').append('');
  26.     //Apparition du fond - .css({'filter' : 'alpha(opacity=80)'})
  27.     $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn();
  28.  
  29.     return false;
  30. });
  31.  
  32. $('a.close, #fade').live('click', function() { //Au clic sur le bouton ou sur le calque...
  33.     $('#fade , .popup_block').fadeOut(function() {
  34.         $('#fade, a.close').remove();
  35.     });
  36.     return false;
  37. });
  38.  
  39. });
  40. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement