Results 1 to 10 of 32

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default Re: category specific css for different browsers

    your are missing the point

    the whole problem is the formatting- and styling of the all different options,
    your solution is more readable, glens is more better since your way will out put the same id for "my object" and "MyOpject"
    or the use of special characters. the only problem is the swatches and comments

    so my hack will just add a class to each swath while leaving the attribImag in its place, so styling will be more versatile.

    the empty divs is a Small do do, and it will be eliminated since its no longer needed, the clearer is a bigger problem because its necessary if you use image swathes; but is laying in the way if you do not need a swath, and will be inserted again and again and again

    the application of a specific class to each option or attrib-swatch is a good start.
    just think of a js mouseOver function to swap a image while on that div, the possibilities are endless if you can pin-point each to its own let alone the styling ability that is not possible w/o this hack
    Last edited by eVelt; 16 Jul 2010 at 03:49 PM.

  2. #2
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: category specific css for different browsers

    Code:
    <div class="attribImg is3-31">
    This provides a unique identifier for that element. No other element can have that identifier.

    That's what an ID is. A class is applied to many elements potentially on the same page. A ID is unique. It's a minor point. There is no reason why a class cannot hold a unique element. It's just that that is what an ID is for so its good programming to use an ID for that..

    Also, in javascript (not using a library like jQuery or Mootools) it is much easier to access a particular element if it has an ID. (And even with jquery, for instance, if you access an element by class jQuery is smart enough to know that this might not be the only one of that type so it creates an array of possibilities.) The javascript for this is getElementById(). There isn't a getElementByClass. That's why most javascript programmers like to have unique IDs for an element.

    getElementById tends to be the base of most image swapping scripts.

  3. #3
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default Re: category specific css for different browsers

    thanks, i did not know that
    the reason why i thought of doing it with classes is because its easy to add it inside an a existing class (class="clas1 clas2") and it will validate nicely, ids however can not contain two values in one element (or so i think)
    i'll rethink it :)

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

    Default Re: category specific css for different browsers

    <div class="attribImg" id="is3-31"> gets both kinds of useful identifiers in good order, so would be the best solution of all (and only takes a few more characters in the code).

  5. #5
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: category specific css for different browsers

    Thanks for that, Glenn. I laughed out loud about the 'few extra characters' . Perhaps I am just the smallest bit anal and pernickety about that I don't think four characters is going to effect the load speed of a zen cart page too much, eh?

    @evelt you can have one id and as many classes as you want. What Glenn says is the best arrangement and will let you access the element in javascript with getElementById('ElementID') or in jQuery (which allows you easily to make the transitions nicer) as $('#elementID') but does involve loading jQuery which comes in at about 25k when minimised which is a whole lot more than a couple of characters in a script!

  6. #6
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default Re: category specific css for different browsers

    hi glenn, niccol, thanks for all your help :)
    i appreciate your time

    i tested the Flexible attributes add on on 1.3.9
    works fine (i added it in my template_default)

    i modified the /includes/modules/attributes.php at 13 places
    i attached a zip containing the modified file :)

    here is a link to a test shop using flexible_attributes + the added ids to the images :)
    Warning! not tested thoroughly -use only on test sites

    http://www.evelt.com/web_design_labo...&products_id=2

    i did not edit anything on attributes comments due to lack of time
    I'll do it shortly and test it as well
    Attached Files Attached Files

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

    Default Re: category specific css for different browsers

    Looks like it should work. I have a suggestion for easier code maintenance: instead of editing 13 lines throughout the file, add one line at the end to insert the id after the class:
    PHP Code:
                    $options_wrapper_id[] = 'wAttrib-' $products_options_names->fields['products_options_id'];//gjh42
                    //following line in place of 13 line edits above
                    
    $tmp_attributes_image str_replace ('class="attribImg"','class="attribImg" id="is-'.$products_options_names->fields['products_options_id'] . '-' $products_options_value_id '"',$tmp_attributes_image);//gjh42 20100716
                    // attributes images table
                    
    $options_attributes_image[] = trim($tmp_attributes_image);
                    
    $products_options_names->MoveNext();
                  } 

 

 

Similar Threads

  1. Problem with CSS in different browsers?
    By wondergirl in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 7 Dec 2008, 04:50 AM
  2. Header in CSS- different in different browsers
    By cgardner in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 14 Jun 2008, 01:49 AM
  3. Multiple stylesheets for different browsers!
    By Shotgun Front in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 18 Apr 2008, 02:26 PM
  4. Switching templates for different browsers
    By Kent in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 11 Apr 2008, 09:49 PM
  5. Different CSS for each Category
    By vulbus in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 30 May 2006, 02:41 AM

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