Reputation: 5820
ther8.com there is a button on the top right as Login
when I click on it, it shows a popup box.
I need to create a similar button and tried the below manner
$( "#domylogin" ).click(function() {
$( "#fancybox-overlay" ).show( "slow" );
});
and the above didn't work.
Also, in Chrome inspector I tried remove div name and class name for the Login
element and tried in the below way
<a href="#popup2">Login</a>
and found this still works. I can't determine how this is working. I need to create another login button in same page but different area which should display the same popup but its not displaying. Can anyone give me an idea how to fix it?
I created a <span id="domylogin">Login</span>
and I want this to work.
I also tried as But this too didn't work
<script type="text/javascript">
function anotherlogin() {
div = document.getElementById('fancybox-overlay');
div.style.display = "block";
}
document.getElementById('domyligin').onclick
{
anotherlogin();
}
</script>
Update1:
I am thinking the #fancybox-overlay and its content is loading on request using AJAX but I am not much sure, can anyone open www.ther8.com and click on the login button on the top and see how the popup is being displayed.
Upvotes: 0
Views: 114
Reputation: 148180
You need to assign the javascript function to onclick for binding handler.
document.getElementById('domyligin').onclick = function()
{
anotherlogin();
}
Edit
Make sure that the elements are added to DOM before you bind event to them, you can put your script just before closing tag of body.
Upvotes: 3
Reputation: 179
Do you include jQuery and fancybox library ?
From your post, it seems using those library.
Upvotes: 0