Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Open the contact form, close with X, open again, close. Have a look at the contact link path. Keeps getting "lightbox2" added to path.
ie: http://www.example.com/contact/lightbox2/lightbox2/lightbox2/lightbox2
I managed to rectify this in lightbox_modal.js, changing:
function lightbox2_contact() {
$("a[@href*='/contact']),...
to...
function lightbox2_contact() {
$("a[@href*='/contact']:not([href*=lightbox2]),...
This would probably effect login too.
Comments
Comment #1
stella CreditAttribution: stella commentedThis is by design, so none of the sidebars, etc, are included in the lightbox, just the form.
Cheers,
Stella
Comment #2
Christopher Herberte CreditAttribution: Christopher Herberte commentedPlease reread the issue. The code i posted checks for the existence of the lightbox2 path and does not add it if it's already there.
Look:
http://www.example.com/contact/lightbox2/lightbox2/lightbox2/lightbox2
Is this necessary?
It is undesirable where I want to read additional parameters from url.
Comment #3
stella CreditAttribution: stella commentedComment #4
elanghout CreditAttribution: elanghout commentedSuggested (better?) solution. Will only add lightbox to links where needed and puts rel:lightmodal on all lightbox links.
function lightbox2_login() {
$("a[@href*='/user/login'][@href!='/user/login/lightbox2'], a[@href*='?q=user/login'][@href!='?q=user/login/lightbox2']").each(function() {
$(this).attr({
href: this.href.replace(/user\/login?/,"user/login/lightbox2"),
});
});
$("a[@href*='/user/login/lightbox2'], a[@href*='?q=user/login/lightbox2']").each(function() {
$(this).attr({
rel: 'lightmodal[|width:250px; height:210px;]'
});
});
}
function lightbox2_contact() {
$("a[@href*='/contact'][@href!='/contact/lightbox2'], a[@href*='?q=contact'][@href!='?q=contact/lightbox2']").each(function() {
$(this).attr({
href: this.href.replace(/contact?/,"contact/lightbox2"),
});
});
$("a[@href*='/contact/lightbox2'], a[@href*='?q=contact/lightbox2']").each(function() {
$(this).attr({
rel: 'lightmodal[|width:450px; height:450px;]'
});
});
}
Comment #5
Monzer Emam CreditAttribution: Monzer Emam commentednither both worked in my test.
Comment #6
Monzer Emam CreditAttribution: Monzer Emam commentedthe following done it ;)
only changed " @href*= " ---------to-------> " @href$= " in 4 places
function lightbox2_login() {
$("a[@href$='/user/login'], a[@href$='?q=user/login']").each(function() {
$(this).attr({
href: this.href.replace(/user\/login?/,"user/login/lightbox2"),
rel: 'lightmodal[|width:250px; height:210px;]'
});
});
}
function lightbox2_contact() {
$("a[@href$='/contact'], a[@href$='?q=contact']").each(function() {
$(this).attr({
href: this.href.replace(/contact?/,"contact/lightbox2"),
rel: 'lightmodal[|width:650px; height:450px;]'
});
});
}
Comment #7
stella CreditAttribution: stella commentedFixed, thanks. It'll be included in the next dev release, available later today.
Comment #9
armyofda12mnkeys CreditAttribution: armyofda12mnkeys commentedwell I tried cutting and pasting, but didnt work for problem i had... the admin page, /admin/build/contact, ends with contact so it gets a popup too...
Solution to not build it for that specific link?:
function lightbox2_contact() {
$("a[@href$='/contact'], a[@href$='?q=contact']").not('[@href*=/admin/build/contact]').each(function() {
$(this).attr({
href: this.href.replace(/contact?/,"contact/lightbox2"),
rel: 'lightmodal[|width:650px; height:450px;]'
});
});
}
Also curious, a /user/login won't get class of lightbox processed if the user is signed in right? i noticed that, and it made sense, just wanted to make sure.