Skip to content

Instantly share code, notes, and snippets.

@jbubriski
Created August 21, 2012 14:44
Show Gist options
  • Save jbubriski/3416172 to your computer and use it in GitHub Desktop.
Save jbubriski/3416172 to your computer and use it in GitHub Desktop.
jQuery buttons?
$(document).ready(function(){
var aInputs = $(":button");
for(var i=0;i<aInputs.length;i++){
var obj = $(aInputs[i]);
if(obj.hasClass("vhm_btn_xsmall") || obj.hasClass("vhm_btn_small") || obj.hasClass("vhm_btn_medium") || obj.hasClass("vhm_btn_large")){
obj.mousedown(function(){
var o = $(this);
var sClass = o.attr("class").toLowerCase();
o.removeClass(sClass);
o.addClass(sClass + "_on");
});
obj.mouseup(function(){
var o = $(this);
var sClass = o.attr("class").toLowerCase();
o.removeClass(sClass);
o.addClass(sClass.replace("_on",""));
});
}
};
var aInputs = $(":submit");
for(var i=0;i<aInputs.length;i++){
var obj = $(aInputs[i]);
if(obj.hasClass("vhm_btn_xsmall") || obj.hasClass("vhm_btn_small") || obj.hasClass("vhm_btn_medium") || obj.hasClass("vhm_btn_large")){
obj.mousedown(function(){
var o = $(this);
var sClass = o.attr("class").toLowerCase();
o.removeClass(sClass);
o.addClass(sClass + "_on");
});
obj.mouseup(function(){
var o = $(this);
var sClass = o.attr("class").toLowerCase();
o.removeClass(sClass);
o.addClass(sClass.replace("_on",""));
});
}
}
});
@codeimpossible
Copy link

I keep reloading the page to see if this has been fixed but ITS STILL HERE!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment