1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

JS callback function to check selector is valid or not. Missing LAN vars for prettyPhoto.

This commit is contained in:
Lóna Lore
2016-03-30 14:29:43 +02:00
parent 2cae5b9023
commit c912c78efa
3 changed files with 21 additions and 1 deletions

View File

@@ -251,6 +251,24 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
}
};
/**
* Check if the selector is valid.
*
* @param selector
* @returns {boolean}
*/
e107.callbacks.isValidSelector = function (selector)
{
try
{
var $element = $(selector);
} catch(error)
{
return false;
}
return true;
};
/**
* Dynamic next/prev.
*

View File

@@ -23,7 +23,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
e107.behaviors.initializeSmoothScrolling = {
attach: function (context, settings)
{
if(window.location.hash)
if(window.location.hash && e107.callbacks.isValidSelector(window.location.hash))
{
$(context).find('body').once('initialize-smooth-scrolling').each(function ()
{