Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

JQuery pull-down menus


Mystefyer

Recommended Posts

Hi,


 


I've been searching my butt off for this and cannot come up with a proper solution as my coding skills are not high enough for this.


 


All over the site jQuery is used to generate the buttons and all sorts of other stuff. Except the pull-down menus, which in a complete styled site looks... well... hidious. 


 


Now I did find a request from someone who asked if an "id" could be automatically added but this caused several issues on other places (http://forums.oscomm...jquerys-plugin/)


 


However my thoughts on this are slightly different on this to use jQuery on it like it is done on the buttons in which I could find the line 



$button .= ').addClass("ui-priority-' . $priority . '").parent().removeClass("tdbLink");</script>'; 

for example which ads a jQuery class. Is something like this also possible for the pulldown menus?


 


Sofar I've come up with



// Output a form pull down menu
function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
global $HTTP_GET_VARS, $HTTP_POST_VARS;

$field = '<select class="ui-widget ui-widget-content ui-widget-header ui-state-default ui-state-highlight" name="' . tep_output_string($name) . '"';
if (tep_not_null($parameters)) $field .= ' ' . $parameters;

$field .= '>';

Which adss some classes and does give a styled look, but not completly (also because I am not sure which classes should be used for a pull-down). It should be possible to do this in a more dynamic way, I think.


 


I hope some bright mind can figure this out.


 


With kind regards,


 


Emile Lensink


Link to comment
Share on other sites

There is no easy solution. Browser support for restyling pulldowns is uneven. You should read this post and also the link in comment #9 to fix the problems with Firefox. That seems to work, at least until Firefox breaks it again.

 

I prefer to just replace the HTML pulldowns with this code. It uses the Bootstrap style, which I like a lot better anyway, and you don't have to fight against a bunch of legacy code to get there. I used this in the Shopping List addon (see below).

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...