/    Sign up×
Community /Pin to ProfileBookmark

need help with document.getElementById

[URL=”http://www.earthinke.co.uk/main_site/product.php”]http://www.earthinke.co.uk/main_site/product.php[/URL]
Hi

I’m trying to get something to work on the site URL’d above but failing miserably.

If you can please follow the link, hit the red rectangle on the RHS and then when the bigger image loads into the DIV above, click on it…

All I want is for this link to open in fancybox (using the class=”earthInke”) but it won’t work from the image…just opens in a new page

Below it you will see a text link, this works as I want it to, but I cannot get it work from the image

Probably something completely wrong in what I am doing or I’ve missed something out, any help would be appreicated guys

Thanks

Pete

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Sup3rkirbyNov 17.2011 — My honest guess is that it's the fact that you create the HTML code containing this new fancybox link after all of the fancybox scripts have initialized. Basically, once the page has loaded it triggers an event which runs some code that sets up all of the fancybox class objects. So any code added to the page after this will work as it naturally would in HTML(no fancybox modification).


But I suppose you don't only want to know what's wrong(or what I assume to be wrong), but how to fix it.

Essentially you'll need to execute the 'fancybox' code again after you add this new element to ensure it also is set up by fancybox's code.
[CODE]
...
$("a.earthInke").fancybox({
'titlePosition' : 'outside',
'overlayColor' : '#000',
'overlayOpacity' : 0.5,

});
...
[/CODE]

However, as I usually don't mess with things such as jQuery, fancybox or any alternatives/derivatives, I don't know how this may affect the rest of the document. Depending on what the script itself does to make the detected classes/links work, it may 'break' when running a second time since everything had been applied once already.

Best way to find out is test it though :p
Copy linkTweet thisAlerts:
@jellygraphicsauthorNov 17.2011 — Thanks - any help is greatly appreciated.

I'll take a look and repost with the results

I definitely want to know what is the problem as well as how to fix - the best way to learn IMHO

Thanks

Pete
Copy linkTweet thisAlerts:
@jellygraphicsauthorNov 17.2011 — Hi

No joy unfortunately, it had no effect ?

Back to the drawing board...

Thanks

Pete:mad:
×

Success!

Help @jellygraphics spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...