如何将此脚本从悬停到onclick并悬停:
$j = jQuery.noConflict();
$j(document).ready(function () {
$j(".swatch-anchor").hover(function () {
var newTitle = $j(this).attr("title");
$j("#colour-name").html(newTitle);
},
function () {
var swapTitle = $j("#colour-name").html();
$j(this).attr("title", swapTitle);
$j("#colour-name").html("");
});
});
答案 0 :(得分:1)
试试这个:
$j = jQuery.noConflict();
$j(document).ready(function () {
$j(".swatch-anchor").on('click mouseenter',function () {
var newTitle = $j(this).attr("title");
$j("#colour-name").html(newTitle);
});
$j(".swatch-anchor").on('mouseleave',function () {
var swapTitle = $j("select-option.selected a").text();
$j("#colour-name").html("");
});
});
答案 1 :(得分:0)
解决:
$j(".swatch-anchor")
.on('mousedown mouseover', function () {
//...
})
.on('mouseup mouseout', function () {
//...
});