WordPress.org

Ready to get started?Download WordPress

Forums

jQuery Responsive Select Menu
[resolved] Please remove line 80 in jquery-responsive-select-menu.php (7 posts)

  1. Forboding Angel
    Member
    Posted 3 months ago #

    Specifically: max-width: 100%;

    The way it is added makes it impossible to override. Nearly perfect plugin otherwise.

    It does, however, need the ability to add placeholder text for each individual menu, as occasionally you might have more than one on a page.

    To be perfectly clear: http://pastebin.com/XmpNpkcG

    Thanks for the great plugin!

    https://wordpress.org/plugins/jquery-responsive-select-menu/

  2. Mickey Kay
    Member
    Plugin Author

    Posted 3 months ago #

    Hi there, and thanks for the feedback.

    Can you tell me why this is so hard to override? All you need to do is include a CSS rule that's more specific, with max-width set to none (or something really high).

    I hear what you're saying, however that rule is in there for a reason - if there is a menu item with tons of text, it can force the select element to grow wider than it's container.

    Thoughts?

  3. Forboding Angel
    Member
    Posted 3 months ago #

    I was targeting that specific element and could not override it, even with important. I spent an hours screwing around trying to figure out how to get around it.

    You have to remember that the way you remove select dropdown buttons for IE, is the make the select element something like 120% wide and a containing element 100% wide with overflow x hidden.

    That way you can do neato things with select menus like this:
    http://i.imgur.com/LcbEKjr.png

    http://i.imgur.com/vvSjqpA.png

    http://i.imgur.com/y31LiuK.png

    Additionally, the end user can set those rules himself, and end user flexibility in this case is much better than reduced functionality due to inexperienced users.

    I would not have been so annoyed with it if I could have reliably overridden it, but try as I might, I could not.

    Another point is that when you are adding these styles, you are essentially adding inline styles, which is ugly and messy anyway. If you want to style them, then to do it correctly, you should really be calling a stylesheet and doing it that way instead of inserting them inline.

    For me this is a ridiculously useful plugin, but at the moment I've basically had to locally fork it, which is less than ideal :-(

  4. Mickey Kay
    Member
    Plugin Author

    Posted 3 months ago #

    Thanks for the feedback, and I'm right on the verge of making the changes you're requesting (note that I did just put out an update solving the unique classes issue you noted :) ).

    Two questions:

    1. Can you explain how the styles I'm including are essentially inline? They are output in the head of the document, which though less ideal than using wp_enqueue_scripts, is a pretty common practice for dynamically generated CSS.

    2. You say you've tried overwriting the rules with !important CSS of your own, and I'm baffled why this wouldn't work. In the hierarchy of CSS priorities, this should work just fine. Can you elaborate on why this isn't working for you? I'm hesitant to change the CSS now, because who knows how many users's sites my unknowingly be affected. Right?

    Thoughts?

    PS - thanks for the constructive criticism, it's not often I get such great suggestions/feedback.

  5. Mickey Kay
    Member
    Plugin Author

    Posted 3 months ago #

    PS - it's also worth noting that this is the first time I've heard of anyone having an issue with the styling, which means statistically it's working for most everyone.

  6. Forboding Angel
    Member
    Posted 3 months ago #

    Well, as I understand it form wp's docs, it essentially adds it to head, which are simply a less evil (but still evil) way of adding inline styles.

    In my experience, inline styles added with jquery involved tend to be extremely difficult to override, because they get added in a non-standard way.

    Regardless, enqueue styles is definitely the way to go, that way you have a proper stylesheet that is being loaded in, instead of them being added in the markup.

    Here are a few resources that should help explain things a little better (cause my explanations fail):
    http://codex.wordpress.org/Function_Reference/wp_enqueue_style

    http://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/ << sort of explains it

  7. Mickey Kay
    Member
    Plugin Author

    Posted 3 months ago #

    Hi again,

    I totally hear what you're saying, and am very familiar with the way wp_enqueue_style works - I'm going on 8 plugins now :)

    jQuery really has nothing to do with this issue, as the CSS is being output entirely separate form the jQuery. Again, the hierarchy of CSS specificity ranks as follows:

    1. Inline CSS (highest, actually on the element)
    2. Embedded (this is what this plugin does, not inline)
    3. External stylesheet

    You can read more here: http://matthewjamestaylor.com/blog/adding-css-to-html-with-link-embed-inline-and-import

    So there's no reason why an !important rule shouldn't work.

    Again, thanks a ton for the great conversation and feedback. I'm going to leave this as is for now, and I hope you understand.

    All the best,
    Mickey

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.