what happens with multiple calls to mouseover and mouseout in jquery -
i creating experiment looks @ number of cells onclick method. testing see if making them appear more hyperlink improves click through rate.
function cursorselect(element){ element.css("cursor","pointer"); } function cursornormal(element){ element.css("cursor","default"); } function colourselect(element){ element.css("color","blue"); } function colournormal(element){ element.css("color","black"); } function variation1(){ //variation 1 code $("td").mouseover(cursorselect($(this))); $("td").mouseout(cursornormal($(this))); } function variation2(){ //variation 2 code $("td").mouseover(colourselect($(this))); $("td").mouseout(colournormal($(this))); } var pagevariations = [ function() {}, //original; mostlikely not need changing function() { //variation 1 goes in here variation1(); }, function (){ //variation 2 goes in here variation2(); }, function (){ //variation 3 goes in here variation1(); variation2(); } ] $(document).ready(pagevariations[chosenvariation]);//jquery launching selected variation
what behaviour of jquery mouseover , mouseout settings. multiple calls method overwrite settings of previous call, or append them?
will multiple calls method overwrite settings of previous call, or append them?
all you're doing jquery code applying css, in javascript add properties element.style
object. long you're not applying same property, merged rather overridden.
however, you'd better off using css this. following:
.variation1 td { color: black } .variation1 td:hover { color: blue; } variation2 td { cursor: default; } .variation2 td:hover { cursor: pointer; }
then, based on whichever variation wanted show, you'd add class variation1
or variation2
top-level element <body>
.