Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Jul 2011
    Posts
    177
    Plugin Contributions
    0

    Default Adding classes to attributes.

    I am trying to follow this tutorial in order to change my attribute radio buttons into images: http://ryanfait.com/resources/custom...radio-buttons/

    It requires the radio button to have a class like so:
    Code:
    <input type="checkbox" class="styled" />
    How can I add a class to my attributes?

  2. #2
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: Adding classes to attributes.

    use the flexible attribute add on, and all will have a class

  3. #3
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Adding classes to attributes.

    They already have a class
    Code:
    .wrapperAttribsOptions
    Zen-Venom Get Bitten

  4. #4
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: Adding classes to attributes.

    Ok you are right. with flexible attribute all attributes get unique classes

  5. #5
    Join Date
    Jul 2011
    Posts
    177
    Plugin Contributions
    0

    Default Re: Adding classes to attributes.

    Quote Originally Posted by Design75 View Post
    Ok you are right. with flexible attribute all attributes get unique classes
    Thank, that's what I needed, unique classes as they will all have different images.

  6. #6
    Join Date
    Jul 2011
    Posts
    177
    Plugin Contributions
    0

    Default Re: Adding classes to attributes.

    Quote Originally Posted by kobra View Post
    They already have a class
    Code:
    .wrapperAttribsOptions
    As far as I can see that class applies to the label and radio button, I need the radio button to have it's own class.

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adding classes to attributes.

    You can address the label and the radiobutton individually under the wrapper class. If you have Flexible Attributes, it could look like
    #wAttrib23 label {}
    where 23 is the id of the option name.

    To get the selected radiobutton, I would have to look at the code; I don't know off the top of my head how or if it is uniquely identified.

  8. #8
    Join Date
    Jul 2011
    Posts
    177
    Plugin Contributions
    0

    Default Re: Adding classes to attributes.

    I have installed the mod 'flexible attributes'. It doesn't seem to have given my attributes classes as suggested above, here is a screenshot of my source code after installation... http://i47.tinypic.com/209mvf8.png

    As you can see we have input type, name, value and id, but no class.

    I am trying to customize my attribute radio buttons following this tutorial: http://ryanfait.com/resources/custom...radio-buttons/
    The first thing it requires is for radio buttons to have a class called 'styled'. I don't know if there is an easier way to achieve image radio buttons but so far this is how I plan on achieving it.

    So, why hasn't the mod given the radio buttons classes as advertised?

  9. #9
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adding classes to attributes.

    It doesn't need to give the radiobuttno a class if the wrapper for the radiobutton has a class; you can address all of the radiobuttons for Gender with #wAttrib2 input {}, or any one of them like #attrib2-4 {} or #attrib2-5 {}. An id is just as good as a class for styling an element, better in some cases.

  10. #10
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adding classes to attributes.

    Reading the tutorial, I see that it uses javascript to address every instance of input, not individual ones as I thought you wanted. In this case, with js not having the same rules as CSS, you probably do need a class tag on the input itself. That would mean editing the tpl_ file, probably.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Adding classes
    By dddmx3 in forum General Questions
    Replies: 0
    Last Post: 8 Apr 2011, 01:30 AM
  2. Adding attributes
    By 001ivy in forum Setting Up Categories, Products, Attributes
    Replies: 12
    Last Post: 11 Dec 2010, 12:14 PM
  3. Adding Classes to navigation
    By dean5000v in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 25 Aug 2009, 03:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR