我尝试将滑块与文本放在一起,当我编写此代码时它会显示错误..
$(".navbar").on("mouseenter" || "click", ".navlink", function (){
//change the current link to be front tab
$(".navlink").removeClass("selected");
$(this).addClass("selected");
//Find the title of the link currently being hovered on
var hoveredlink = $(this).attr("title");
//add the selector # and concatenate
var targetslides = ("#" + hoveredlink).toString();
//get the classes of the link in focus
var grabtarget = $(targetslides).attr("class");
//Parse to a string for comparison
var isitONalready = grabtarget.toString();
console.log(isitONalready)
//Possible variations returned as grabtarget
itISonalready = "slideset current"
itISonalready2 = "slideset .current"
itISonalready3 = ".slideset .current"
//If it's already visible
if (isitONalready === itISonalready || isitONalready === itISonalready2 || isitONalready === itISonalready3){
console.log("It is on already")
return;
}
//If it isn't visible
else if (isitONalready !== itISonalready && isitONalready !== itISonalready2 && isitONalready !== itISonalready3){
//Fade out current slides
$(".slideset").removeClass("current")
.hide();
//find the slides we want to show
correctslides = $(".slideset").closest(targetslides);
//show the slides
$(correctslides).addClass("current")
.fadeIn("fast");
}
});
你们可以请检查为什么它会向我显示“对象#没有方法”这个错误?对我来说,我认为这是正确的吗?