JQuery - 单击href ID在一个页面上无法识别,适用于所有其他页面

时间:2013-11-22 20:46:24

标签: jquery

可能最好在Chrome中查看此内容。

http://onrepeatthisweek.tumblr.com/post/39128891344/011-milhaven-supervulkan

如果您点击页面底部的评论链接,您将看到所需的行为(减去一些样式)。

如果您点击底部的任何其他歌曲,您会看到评论链接具有相同的所需行为...

APART来自第一首歌: http://onrepeatthisweek.tumblr.com/post/39129026301/012-keane-clear-skies-villa-remix

无法识别点击。

功能:

function showAndPlayTune() {
document.getElementById('content').style.display = 'inline';

//then autoplay it plus change the UI to pause
document.getElementById('GristyPlayer').play();
document.getElementById('GristyPlayer-Play').click();

//and display the player page favicon
var faviconPlayLink = document.createElement('link');
faviconPlayLink.type = 'image/x-icon';
faviconPlayLink.rel = 'shortcut icon';
faviconPlayLink.href = 'http://www.thomasgrist.co.uk/totw/img/favicon2-play.png';
document.getElementsByTagName('head')[0].appendChild(faviconPlayLink);

//and apply a highlight to the page / song that we're on, plus setup the comments link
$('a[href$="' + currenturl2 + '"]').css("font-family", "\'Apercu Bold\'");
$('a[href$="' + currenturl2 + '"]').parent().css("background-color", "rgba(0, 0, 0, 0)");
$('a[href$="' + currenturl2 + '"]').append('<br/><span style="text-decoration:underline;font-family:\'Apercu Regular\';">Comments</span>');
$('a[href$="' + currenturl2 + '"]').attr({
href: "#",
id: "openComments"
});

//fade in social overlay on Facebook click
$("#openComments").click(function() {
    alert('click');
$("#commentsOverlay").fadeIn(400);
});

}

//run that function
window.onload = showAndPlayTune;

0 个答案:

没有答案