Ayuda con javascript (popboxes)

K

Hola a todos,

Os pongo en situación, tengo diseñada una web en la que algunos links están direccionados a diferentes popboxes(popups) para añadir información.

Mi problema es que quiero acceder a estos popups sin necesidad de clickar en links, simplemente haciendo una redirección tipo header(location: "" ) o algún metodo parecido para saltar de un popbox a otro.

Os pego el codigo para que os orienteis:

Aqui teneis los links mediante los cuales accedo a los popbox

<a href="#?w=368" rel="search_camera" class="poplight"><div id="navigation-block"><div id="icon16" class="camera search"></div><p><?php echo SEARCHCAMERA; ?></p></div></a>

Este es el javascript del popbox

$(document).ready(function() {
  //When you click on a link with class of poplight and the href starts with a # 
	$('a.poplight[href^=#]').click(function() {
	    var popID = $(this).attr('rel'); //Get Popup Name
	    var popURL = $(this).attr('href'); //Get Popup href to define size
	
    // Pull Query & Variables from href URL
    var query= popURL.split('?');
    var dim= query[1].split('&');
    var popWidth = dim[0].split('=')[1]; //Gets the first query string value

    //Fade in the Popup and add close button
    $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) });

    //Define margin for center alignment (vertical   horizontal) - we add 80px to the height/width to accommodate for the padding and border width defined in the css
    //var popMargTop = ($('#' + popID).height()) / 2;
    var popMargLeft = ($('#' + popID).width()) / 2;

    //Apply Margin to Popup
    $('#' + popID).css({
    	//'margin-top' : -popMargTop,
    	'margin-left' : -popMargLeft
    });

    return false;
});

//Close Popups and Fade Layer
$('a.close_modal').live('click', function() { //When clicking on the close or fade layer...
    $('.popbox').fadeOut(function() {
    });
    return false;
});	

var mouse_is_inside = false;

  $('.popbox').hover(function(){ 
    mouse_is_inside=true; 
    }, function(){ 
    mouse_is_inside=false; 
    });
  
$('html').live('click', function() { if(! mouse_is_inside) $('.popbox').fadeOut(function() { }); }); $(document).keyup(function(e){ //When clicking esc key if(e.keyCode == 27){ $('.popbox').fadeOut(function() { }); } }); });
yarviT0

uhm igual no me he enterado muy bien pero, window.location.href ? (redirect de js)

15 días después
K

gracias por la respuesta, pero ya lo solucioné de otro modo. Simplemente descargue una api de popus mas facil de manejar.

Usuarios habituales

  • kikudo
  • yarviT0