Using jQuery to window location to rel value
-
06-07-2019 - |
Question
I'm using the jQuery UI-tabs and rather than activate them onclick I am using :hover to change tabs. I would like for the link to take the user to the URL that is specified in the rel attribute, but I'm coming up empty handed in trying to find a solution.
Solution
How about:
function hoverEventHandler(){
window.location.href = $(this).attr("rel");
}
OTHER TIPS
you can bind hover event to the links and select specific tabs based on hovered element:
$("a.tab_links").hover(function(){
var $tabs = $('#example').tabs();
var selected = $tabs.tabs('select', 2);//select third tab.
});
You can use selected
callback for opening link:
$('#example').tabs({
select: function(event, ui) {
var lnk = ui.tab;
var href = $(lnk).attr("rel");
OPEN_LINK(href);//write function or code for this
return false;//don't open on clicking on link;
}
});
PS:- this stuff is from jquery ui tabs documentation page.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow