Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.

  • 21/11/2023 BLACK FRIDAY 23 is coming

    BIG SALE, 35% discount for all our extensions. Use BF23 coupon code. Hurry up the discount is valid till 27 November.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

Exclude external links
(1 viewing) (1) Guest
"ARI Fancy Lightbox" WordPress plugin
Go to bottomPage: 12
TOPIC: Exclude external links
#65335
Exclude external links 4 Years, 9 Months ago Karma: 0
Hi there

I have set up ARI lightbox to show external links in the lightbox and it is working great. However, some sites like certain social media sites do not allow iframes.

I know that it is possible to add the "no-lightbox" CSS class to each of those links to stop this.

The problem is that I have far too many links on my site.

Is there a way I can make a list of certain sites or URLs to be excluded from being loaded in the lightbox.

This would work great in tandem with the feature of external sites being loaded in the lightbox as not all sites allow it and it would be much easier if I can make a general list of URLs that will be excluded or filtered from being loaded in the lightbox.
The administrator has disabled public write access.
 
#65350
Re:Exclude external links 4 Years, 9 Months ago Karma: 748
Hello,

Open "ARI Fancy Lightbox -> Settings -> Advanced" page and populate "Custom JS code" parameter with the following code:

Code:


var ignoreSites = [
  'google.com',
  'yahoo.com'
];
$('a[href]').each(function() {
  var $a = $(this), domain = ARI_FANCYBOX_HELPER.getLinkPart($a.attr('href'));
  if (ignoreSites.indexOf(domain) !== -1) {
     $a.addClass('no-lightbox');
  }
});



It will ignore links for google.com and yahoo.com sites. You can populate ignoreSites variable with your domains.

Regards,
ARI Soft
The administrator has disabled public write access.
 
#65497
Re:Exclude external links 4 Years, 8 Months ago Karma: 0
I am looking for the same solution. I tried your code however it's still trying to pull it into the lightbox.
The administrator has disabled public write access.
 
#65499
Re:Exclude external links 4 Years, 8 Months ago Karma: 748
Could you provide a link to a page where the code doesn't work and specify what link(s) you want to exclude?

Regards,
ARI Soft
The administrator has disabled public write access.
 
#65501
Re:Exclude external links 4 Years, 8 Months ago Karma: 0
I want to exclude it from all the links on this page:

www.keystonebldg.com/products-kitchen-cabinets/
The administrator has disabled public write access.
 
#65503
Re:Exclude external links 4 Years, 8 Months ago Karma: 748
The code doesn't work because links on the page contains www. prefix, but it is not specified in ignoreSites variable. You can use the following code to ignore links with or without "www." prefix:

Code:


var ignoreSites = [
  'google.com',
  'yahoo.com'
];
$('a[href]').each(function() {
  var $a = $(this), domain = ARI_FANCYBOX_HELPER.getLinkPart($a.attr('href')).replace(/^www./i, '');
  if (ignoreSites.indexOf(domain) !== -1) {
     $a.addClass('no-lightbox');
  }
});



Regards,
ARI Soft
The administrator has disabled public write access.
 
Go to topPage: 12