开发者

How can I highlight the active link in the page and change the color of the selected links in the page?

开发者 https://www.devze.com 2023-03-13 04:42 出处:网络
I have made a video gallery using videolightbox tool. It has generated query for it to work. I have no idea about any scripting.

I have made a video gallery using videolightbox tool. It has generated query for it to work. I have no idea about any scripting.

I just want to highlight the active link in the page and change the color of the selected links in the page. I sure it can be done.

Also is there a way to bookmark the visited links on the page as external txt file? so that when the page gets loaded next day I still be able to have the visited links high lighted. Hope it can be done too.

jQuery(function () {
    var $ = jQuery;
    var swfID = "video_overlay";
    if (!document.getElementById("vcontainer")) {
        $("body").append($("<div id='voverlay'></div>"));
        $("#voverlay").append($("<div id = 'vcontainer'></div>"));
    }
    $("#vi开发者_Python百科deogallery a[rel]").overlay({
        api: true,
        expose: 0.7 ? {
            color: "#55aaff",
            loadSpeed: 400,
            opacity: 0.7
        } : null,
        onClose: function () {
            swfobject.removeSWF(swfID);
        },
        onBeforeLoad: function () {
            var c = document.getElementById(swfID);
            if (!c) {
                var d = $("<div></div>");
                d.attr({
                    id: swfID
                });
                $("#vcontainer").append(d);
            }
            var wmkText = "VideoLightBox";
            var wmkLink = "http://videolightbox.com";
            c = wmkText ? $("<div></div>") : 0;
            if (c) {
                c.css({
                    position: "absolute",
                    right: "38px",
                    top: "38px",
                    padding: "0 0 0 0"
                });
                $("#vcontainer").append(c);
            }
            if (c && document.all) {
                var f = $("<iframe src=\"javascript:false\"></iframe>");
                f.css({
                    position: "absolute",
                    left: 0,
                    top: 0,
                    width: "100%",
                    height: "100%",
                    filter: "alpha(opacity=0)"
                });
                f.attr({
                    scrolling: "no",
                    framespacing: 0,
                    border: 0,
                    frameBorder: "no"
                });
                c.append(f);
            }
            var d = c ? $(document.createElement("A")) : c;
            if (d) {
                d.css({
                    position: "relative",
                    display: "block",
                    'background-color': "#E4EFEB",
                    color: "#837F80",
                    'font-family': "Lucida Grande,Arial,Verdana,sans-serif",
                    'font-size': "11px",
                    'font-weight': "normal",
                    'font-style': "normal",
                    padding: "1px 5px",
                    opacity: 0.7,
                    filter: "alpha(opacity=70)",
                    width: "auto",
                    height: "auto",
                    margin: "0 0 0 0",
                    outline: "none"
                });
                d.attr({
                    href: wmkLink
                });
                d.html(wmkText);
                d.bind("contextmenu", function (eventObject) {
                    return false;
                });
                c.append(d);
            }
            var src = this.getTrigger().attr("href");
            if (typeof d != "number" && (!c || !c.html || !c.html())) {
                return;
            }
            if (true) {
                var this_overlay = this;
                window.videolb_complite_event = function () {
                    this_overlay.close();
                };
                window.onYouTubePlayerReady = function (playerId) {
                    var player = $("#" + swfID).get(0);
                    if (player.addEventListener) {
                        player.addEventListener("onStateChange", "videolb_YTStateChange");
                    } else {
                        player.attachEvent("onStateChange", "videolb_YTStateChange");
                    }
                    window.videolb_YTStateChange = function (newState) {
                        if (!newState) {
                            this_overlay.close();
                        }
                    };
                };
            }
            swfobject.createSWF({
                data: src,
                width: "100%",
                height: "100%",
                wmode: "opaque"
            }, {
                allowScriptAccess: "always",
                allowFullScreen: true,
                FlashVars: true ? "complete_event=videolb_complite_event()&enablejsapi=1" : ""
            }, swfID);
        }
    });
});


read this please: How to change the href for a hyperlink using jQuery

0

精彩评论

暂无评论...
验证码 换一张
取 消