Skip to content

Instantly share code, notes, and snippets.

@rcstr
Created December 15, 2014 22:34
Show Gist options
  • Save rcstr/75f341e165461e373ac7 to your computer and use it in GitHub Desktop.
Save rcstr/75f341e165461e373ac7 to your computer and use it in GitHub Desktop.
$("li .active span", '#list').each(bindEvenToSpan);
function bindEvenToSpan(i, elem) {
var $this = $(elem);
if($this.hasClass('shouldReact')) {
$this.on('mouseenter', addCssToSpan);
}
}
function addCssToSpan() {
var $this = $(this),
content = $this.data('newcontent');
$this.css({
border:'1px solid #cccccc',
backgroundImage: 'url("/newbg.png") 10px 36px no-repeat',
}).html(content);
// persnally i would just create a new class and add the class to the element instead of add the inline css
// $this.addClass('superstar');
}
.superstar {
background: url("/newbg.png") 10px 36px no-repeat;
border: 1px solid #cccccc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment