I have a page for member\'s where log in is essential. On this page members get links for lectures conducted. Lectures links get added regularly. And Links to recording are fet
Here is a sort of hack to achieve this function
two efficient ways to go about this
1.
document.$('fancybox').addEventListener('click', function() { window.location.href = '$=data['recording_link']?>' } );
//non-jquery:
document.getElementsByClassName('fancybox')[0].addEventListener('click', function() { window.location.href = '=$data['recording_link']?>' } );
But as @Dr_J_Manish has already stated this doesn't work but will instead direct him to a nonsensical webpage address at '=$data['recording_link']?>
' (Not a website address... DUH.)
2.
The second approach absolutely will work for @DR_J_Manish 's purpose: to activate a PHP function on a link click w/out the annoying overlay that appears when hovering a link.
To achieve this we will need to use a major workaround... This workaround could be considered a 'HACK':
Make a new element and give it the ID 'Play-Recording':
Make another new element which is exactly the same as @DR_J_Manish 's code above except for the class and other styling attributes.
I'm Hidden!
Make sure that this element is at the VERY BOTTOM of the Body tag or else there could be interference.
Now make this element invisible and always off the screen...
Code so far should look like:
I'm Hidden!
Now for the fun part... Javascript... This part is pretty simple... add this code to the bottom of your page just after the I'm hidden
tag we just made
So your final code snippet should look like:
I'm Hidden!
Now if you really want to be efficient then you could research how to do PHP
commands in javascript
... but I know thats not the easiest...
You could also transfer the code inside the script
tag to a .js file and then link it like so --> .
Here is a snippet to demonstrate what type of thing i'm going for...
var button1 = document.getElementById('click1');
var button2 = document.getElementById('click2');
button1.addEventListener('click', function() { button2.click() } );
And get the same result as
Re-Run the code-snippet to see the code in use again in case you missed it...
Notice how with the first button there isn't any href attribute or anchor tag (the 'a' tag).