Git Product home page Git Product logo

Comments (9)

aimeos avatar aimeos commented on June 11, 2024 1

The problem is that zeynep uses the link name, e.g. data-submenu="Best sellers" and id="#Best sellers". The last one doesn't work because it's an invalid ID that is used here: https://github.com/hsynlms/zeynepjs/blob/master/src/zeynep.js#L31

A solution could be to use name.replace(/[# .,>~*+\[\]="()'&%$:]*/, '') to replace all characters which are not allowed or have a special meaning in IDs and selectors (https://html.spec.whatwg.org/multipage/dom.html#the-id-attribute)

from zeynepjs.

aimeos avatar aimeos commented on June 11, 2024 1

@hsynlms Will you fix the code? Because the link texts you use can always contain spaces which will result in invalid IDs.

from zeynepjs.

hsynlms avatar hsynlms commented on June 11, 2024

Hi @alpin3rocker

Thank you!

Could you please give an example or screenshot or video or reproduceable demo project zip file, please? So I can help you faster.

from zeynepjs.

ivanbilj avatar ivanbilj commented on June 11, 2024

I also noticed this lovely little problem.

F.e.:
Label = Main categories, breaks the navigation on mobile.
Renaming: Label = Maincategories, and it works like a charm.
Screenshot from 2021-07-13 16-00-21

from zeynepjs.

hsynlms avatar hsynlms commented on June 11, 2024

It seems your case is resolved that way @alpin3rocker

Thank you @aimeos , as you said it's not valid to use space characters in the ID attribute of an HTML element.

So I am gonna close the case.

from zeynepjs.

hsynlms avatar hsynlms commented on June 11, 2024

@aimeos this case is not related to the plugin. What you are suggesting is to tolerate invalid ID attribute usages.

Instead, the spaces need to be removed or replaced with another character in the HTML file before getting rendered. This is a valid and permanent solution. Replacing or removing characters is easy to do in any template rendering engine.

from zeynepjs.

ivanbilj avatar ivanbilj commented on June 11, 2024

Happy there is a valid and permanent solution.
At least I do not have to ask my friend to move away from "Tuna Mahallesi" and stop him from selling products containing more than only one word :)

from zeynepjs.

hsynlms avatar hsynlms commented on June 11, 2024

@ivanbilj you do not need to remove whitespaces from the visible sub-category name. Just remove or replace the whitespaces in data-submenu and in data-submenu-close and in id attributes to make it work. Those attributes' values need to match.

https://github.com/hsynlms/zeynepjs/blob/master/examples/multi-menu.html#L52

https://github.com/hsynlms/zeynepjs/blob/master/examples/multi-menu.html#L54

Example:

...
...
<a href="#" data-submenu="tunaMahallesi">Tuna Mahallesi</a>    <!-- attention: data-submenu="tunaMahallesi" -->

<div id="tunaMahallesi" class="submenu">                       <!-- attention: id="tunaMahallesi" -->
  <div class="submenu-header">
    <a href="#" data-submenu-close="tunaMahallesi">Menu</a>    <!-- attention: data-submenu-close="tunaMahallesi" -->
  </div>

  <label>Tuna Mahallesi</label>                                <!-- attention: no need to modify the visible name  -->

  ...
  ...
</div>
...
...

Hope that's clear enough.

from zeynepjs.

ivanbilj avatar ivanbilj commented on June 11, 2024

Thank you very much for the clarification, really appreciate it!!

from zeynepjs.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.