- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Help with JavaScript
Please help me simply have the links below open in A NEW WINDOW. For example, in HTML, you would use the target=”_blank” code in an HTML link, but in Javascript, I have No Clue.
var $el, $tempDiv, $tempButton, divHeight = 0;
$.fn.middleBoxButton = function(text, url) {
return this.hover(function(e) {
$el = $(this).css("border-color", "white");
divHeight = $el.height() + parseInt($el.css("padding-top")) + parseInt($el.css("padding-bottom"));
$tempDiv = $("", {
"class": "overlay rounded"
});
$tempButton = $("", {
"href": url,
"text": text,
"class": "widget-button rounded",
"css": {
"top": (divHeight / 2) - 7 + "px"
}
}).appendTo($tempDiv);
$tempDiv.appendTo($el);
}, function(e) {
$el = $(this).css("border-color", "#999");
$(".overlay").fadeOut("fast", function() {
$(this).remove();
})
});
}
$(function() {
$(".widget-one").middleBoxButton("Action Games","action.htm");
$(".widget-two").middleBoxButton("Adventure Games", "adventure.htm");
$(".widget-three").middleBoxButton("Arcade Games", "arcade.htm");
$(".widget-four").middleBoxButton("Puzzle Games", "puzzle.htm");
$(".widget-five").middleBoxButton("Sport Games", "sport.htm");
$(".widget-six").middleBoxButton("Search Games", "searchgames.htm");
});
Thanks For Your Time!
CSS-TRICKS:
https://css-tricks.com/examples/MiddleBoxLinks/