-
What's wrong with my Javascript code?
Hello, I've been learning Javascript and as a bit of practice, thought i'd create myself a dropdown navigation menu, that works on a 'click' rather than hover. I've created the code below (which doesn't work) and i was wondering if someone could explain why so i can see where i've gone wrong. I can get the dropdown to open, but when i added the code to close the dropdown, the dropdown menu doesn't even open. I'm hoping someonce can point me in the right direction so i can see where i'm going wrong Here's the HTML... <nav class="main-nav"> <ul> <li><a href="" title="Home">Home</a></li> <li class="menu-item-has-children"><a href="#" title="What We Do">What We Do</a> <ul class="sub-menu"> <li><a href="" title="">Page 1</a></li> <li><a href="" title="">Page 2</a></li> <li><a href="" title="">Page 3</a></li> <li><a href="" title="">Page 4</a></li> <li><a href="" title=" ">Page 5</a></li> <li><a href="" title="">Page 6</a></li> </ul></li> <li class="menu-item-has-children"><a href="#" title="Our Work">Our Work</a> <ul class="sub-menu"> <li><a href="" title="">Portfolio 1</a></li> <li><a href="" title="">Portfolio 2</a></li> <li><a href="" title="">Portfolio 3</a></li> <li><a href="" title="">Portfolio 4</a></li> <li><a href="" title="">Portfolio 5</a></li> </ul> </li> <li><a href="" title="">Contact</a></li> </ul> </nav> Here's the Javascript... // Dropdown Menu (function(){ let menuHeader = document.querySelectorAll('.menu-item-has-children'); let subMenu = document.querySelector('.sub-menu'); menuHeader.forEach(function(btn){ btn.addEventListener('click', function(event){ subMenu.classList.add('nav-open'); // Close if anywhere on screen aprt form menu is clicked window.onclick = function(event){ if (!event.target.classList.contains('sub-menu')){ subMenu.classList.remove('nav-open'); } }; }); }); })(); Thanks in advance Ross
-
Website - language options
Thanks for your reply. I'll take a look at WPML then
-
Website - language options
Hi, I recently built a website for a client who targets clients in the UK, Singapore, Hong Kong and also China, the website has been built using Wordpress and is currently in English. My client would like to add a button where the website user can click a button and it changes the text to Chinese/Mandarin. We have no issues with having the text translated however i just wondered what the best course of actio to take is. Can anyone suggest a straight forward enough plugin that i can use to achive this? As an alternative i was thinking about creating the same website but in chinese and using a .CN domain. Would this be a more suiable option do you think? Thanks for for any advice
-
Wordpress - Not sure on best approach for this project
Thaks for your reply Mantis. I never thought of using the image and caption, maybe that is something i can tweak to work with this but i will most likely end going back to creating a custom post type.
-
Wordpress - Not sure on best approach for this project
Hi everyone. I am currently working on a project that the goalposts have moved slightly on and i'm wondering if anyone could advise me on the best approach to take now. I am coding a Wordpress site for a designer that has a section entitled Farm Shop. This isn't an online shop in the respect that clients order and pay online but one where the user can view all of the products and submit their order through an online form or by calling up (so more of a catalogue). When i saw the initial brief each product was going to have it's own page with a reasonable amount of information and images for each product. My idea was to create a custom post type and that would do the trick nicely. When i received the final design and content each product only had a title, 1 image and a price. They were all listed down the page (as you would usually see post excerpts with thumbnails) without having a single.php page designed for them and to be honest as there isn't really any content for each product it seems like overkill creating a custom post type for them. So i'm trying to find an alternative route now. I thought about just creating a page for each category then listing the items on the page but each product will need to go in it's own div for styling and i think it's going to be quite easy for that to get messy once the client gets their hands on it. Is there a method in which the client can enter the info and image for each product (by using custom fields) then have each product output onto a page template? I'm sure there must and i've been searching Google for this but without knowing what i'm looking for it's difficult to know what to search. Any help or advise would be appreciated Thanks
-
Twitter Widget - Good for SEO?
It's not the keywords that he deems to be good for SEO, more the fresh, new content that is updated on a regular basis.
-
Twitter Widget - Good for SEO?
Thanks for the reply. I'll take a look at that
-
-
Twitter Widget - Good for SEO?
Can anyone help with this please?
-
Twitter Widget - Good for SEO?
I have been asked by a client of mine to have a look at his website (designed and developed by someone else) and give my feedback as to what would improve the look and feel of the site. One of the things that i didn't like about it was this massive, horrible embedded Twitter widget that spans the height of his sidebar and i feel it isn't doing him any favours in terms of appearance. I have suggested he either get rid of it all together or have it sat in the footer with much fewer tweets showing. He wasn't very keen on this idea as he has been told by his developer that it is good for SEO purposes as it is regularly updated content. I've had a look at the source code of his page and it doesnt show any of the tweets embedded into the code but just the source of the widget and styling options. Will he be getting any benefits at all from this? I've had a look at the script and the script he is using is twitter-text-js. Thanks
- Best way to do this in wordpress? (shop like site but without shop functionality)
-
Struggling to find clients
One idea that might be worth a go is BNI. Have you ever heard of it? It's a weekly breakfast networking meeting where each chapter can only have one member from a particular trade/industry. Each member is obliged to get work for one another. We tried it a few years back for the Graphic Design part of our business and we got lots of business from it. It is quite expensive (about £500 + vat) for the year followed by approx £10 per week that covers your breakfast etc but it will pay for itself many times over.
-
Annoying Salespeople
We used to get loads, especially gas and electric. We signed up for the telephone preference service and things aren't as bad now. If people call you tell them you are on the telephone preference service and they should poo themselves then run. I think it is setup by ofcom but i arent sure on that.
-
Website different depending on browser?
No problem, glad it worked
-
Website different depending on browser?
Also as was mentioned previously a CSS Reset would be a good idea for this and any future projects
-
Website different depending on browser?
It could be that all of the elements within #header-right with their respective widths, margins and paddings don't fit within the 250px you have allowed it. As a test try adding 10px to #header-right. If that works and the layout looks pretty much as it should do then you know that was the problem. I suspect it is. You will then just need to tweak your width, padding or margin on one of the elements (or even the div itself) to fit it as it should be.