Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Nillervision

Privileged
  • Joined

  • Last visited

Solutions

  1. Nillervision's post in Responsive menu not working was marked as the answer   
    There is a few issues first of all classnames must be separathed with a space
    This:
    if (x.className === "navigation-desktop") { x.className += "navigation-mobile"; } will result in:
    class="navigation-desktopnavigation-mobile" So you should ad a whitespace before the classname
    if (x.className === "navigation-desktop") { x.className += " navigation-mobile"; } or even better have a look at classList.toggle
     
    For the CSS you should remove the whitespace between
    .navigation-desktop .navigation-mobile You do not want to target a child element but the same element with the ekstra classname.
     
     
    I did a few other changes to your code (removed the click event from the HTML markup and added it to the script instead)
     
    Here is a working fiddle
     
    And here is the entire source:
    <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <style> html,body { font-family: 'Open Sans',sans-serif; background-color: #ffffff; margin: 0px; } .container { position: relative; clear: both; padding: 0px; margin: 0px; } .navigation { background-color: #000099; height: 400px; color: #ffffff; } .navigation-desktop { overflow: hidden; background-color: #333; } .navigation-desktop a { float: left; display: block; color: #f2f2f2; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px; } .navigation-desktop a:hover { background-color: #ddd; color: black; } .active { background-color: #4CAF50; color: white; } .navigation-desktop .icon { display: none; } /*-- solves floating problems, by forcing the section to self clear its children (aka the clearfix hack). This is good in Firefox 3.5+, Safari 4+, Chrome, Opera 9+ and IE 6+. --*/ .group:before, .group:after { content:""; display:table; } .group:after { clear:both; } .group { zoom:1; /* For IE 6/7 */ } @media screen and (max-width: 1024px) { .navigation-desktop a:not(:first-child) { display: none; } .navigation-desktop a.icon { float: right; display: block; } .navigation-desktop.navigation-mobile { position: relative; } .navigation-desktop.navigation-mobile .icon { position: absolute; right: 0; top: 0; } .navigation-desktop.navigation-mobile a { float: none; display: block; text-align: left; } } </style> </head> <body> <div class="container navigation group"> <div class="navigation-desktop" id="myNavigation"> <a href="index.html" class="active">Home</a> <a href="index.html">Item 1</a> <a href="index.html">Item 2</a> <a href="index.html">Item 3</a> <a id="burger" href="#" style="font-size:15px;" class="icon">☰</a> </div> </div> <script> function myFunction(event) { event.preventDefault(); var x = document.getElementById("myNavigation"); if (x.className === "navigation-desktop") { x.className += " navigation-mobile"; } else { x.className = "navigation-desktop"; } } var burger = document.getElementById('burger'); burger.addEventListener('click', myFunction); </script> </body> </html>
  2. Nillervision's post in Excluding Animation Elements Loading Via JS? was marked as the answer   
    Generating content with JS does not guarantee that it will not be indexed .
    Google and other search engines can actually run JS on a page and decide that the generated content should be indexed. There are better ways to do exclude content from indexing. Try a noindex tag:
    <html> <head> </head> <body> <p>This content will be indexed</p> <!--noindex--> <p>This content will not be indexed</p> <p>Place your animation elements here</p> <!--/noindex--> <p>This content will be indexed</p> </body> </html> BTW your JavaScript syntax is wrong.
    It is innerHTML not InnerHTML, and the ID you want to select is a string so it should be in quotes
    document.getElementById("the-id-must-be-in-quotes").innerHTML = "The string you want to generate";
  3. Nillervision's post in Unwanted padding on Android with CSS3 Animations. was marked as the answer   
    Maybe you should try to animate the transform:scale() property rather than the font size.
    Transform properties are made exactly for that sort of thing, and are much smoother as they are hardware accelerated on many devices (calculations can be done by the graphic card rather than the OS/browser).
     
    Also changing font sizes can give you problems as browsers set initial values for properties like line-heights, margin etc. which also would have to be animated for accurate results.
     
    Try this instead:
    @keyframes zoomin { 0% {transform: scale(1); /*Full size*/} 90% {transform: scale(0.5); /*Half size*/ opacity: 100;} 100% {transform: scale(0.5); opacity: 0;} }
  4. Nillervision's post in Is this possible - iframe button redirect? was marked as the answer   
    No
    Only way to change the behavior on a button in the iframe is to have an absolute positioned invisible element over it with its own link or click event attached.
    But that could very well be seen as nasty black hat woodoo by search engines
  5. Nillervision's post in HTML5 Video not Autoplaying in Chrome, Safari or Opera was marked as the answer   
    Can you autoplay the video with javascript?
    <script> document.addEventListener('DOMContentLoaded', function(){ var mainVideo= document.getElementById('main-video'); mainVideo.play(); }); </script>
  6. Nillervision's post in CSS Question was marked as the answer   
    It depends on what you want. If you don't declare any values the elements will be rendered with default values, (which very often works fine).
    Some people like to reset everything but zeroing out all values (often just to add values close to the defaults again later) can make your CSS unnecessary bloated. A few resets which are important though are:
    Zero out the html and body elements margin/padding. Make sure HTML5 block elements are set to display block ( IE/Edge still renders the main element as an inline element by default ) Also set every (block) element to substract borders/padding from the width/height. (box-sizing:border-box) You certainly don't need to declare border: none; for articles (and most other elements) as most elements don't have borders by default.
  7. Nillervision's post in jQuery not loading when making ajax call... was marked as the answer   
    The settings of the .ajax() method (second parameter) must be an object with key and value pairs:
    jQuery.ajax( url , {key : value} ) In your case you want to call an anonynous function if the request succeeds. success is the key and the function is the value:
    $.ajax('confirmation.html', { success: function (response) { $('body').html(response).slideDown('slow'); } }); So this would work. But slideDown() doesn't work well with the body element because the loaded content overflows. So create an empty div for the loaded content instead:
    <div id="content"></div> You should also hide the element before the slide down effect:
    $('#content').hide().html(response).slideDown('slow'); (can be done with your initial CSS instead)
     
     
    Finally it is always good practice to have a handler for errors when loading content, and luckily the settings object (2nd parameter, remember) also have a key/value set for that
    { success: function (response) { $('#content').hide().html(response).slideDown('slow'); }, error: function () { $('#content').hide().text('Error: content could not be loaded').slideDown('slow'); } } Your entire code should look like this:
    $(document).ready(function () { alert('jQuery Loaded!'); $(document).on('click', function () { alert('Clicked'); $.ajax('confirmation.html', { success: function (response) { $('#content').hide().html(response).slideDown('slow'); }, error: function () { $('#content').hide().text('Error: content could not be loaded').slideDown('slow'); } }); }); }); This has been tested and works fine, however AJAX only works on a server (or a virtual localhost)
  8. Nillervision's post in Alert box on text link was marked as the answer   
    It is generally not recommended to use JavaScript inline, but since you say this is just temporary this would be the easiest way.
    <a onclick="alert('You clicked the temporary disabled login button'); return false;" href="" style="text-decoration:none">Log in</a> Note the return statement with the value "false" this prevents the browser from the default action (navigate to the href)
  9. Nillervision's post in Drop down menu was marked as the answer   
    Usually you would do that with JavaScript but as a beginnner it might be better to use an all CSS approach. This is achived with a combination of a hidden checkbox element and a visible label element for the same checkbox. The checkbox' state in combination with the "+" selector can be used to hide/show the menu if it is placed immediately after the checkbox in the mark-up.
    Note: This sollution works with clicks (and touch events on mobiles) rather than hover.
     
    Here is a fiddle:https://jsfiddle.net/Nillervision/wq6L4v2g/
    NOTE: Just remove the media queries from the css (from line 30 to the end) if you want a dropdown at all resolutions.
     
    EDIT: Looks like teodora beat me to it (gotta learn to type faster)
  10. Nillervision's post in Jquery Click Event Problem was marked as the answer   
    $(".sortable").click(function(e) { $(this).find(".sectionDropDown").slideToggle(); }); ...should do it
     
    EDIT: Fiddle here: https://jsfiddle.net/Nillervision/uagwLh7a/
  11. Nillervision's post in Show / hide social share icons on horizontal view was marked as the answer   
    Changing the value of the button will be very difficult without JavaScript.
    But remember the empty onclick attribute, that I mentioned was needed because of a bug in IOS in the CSS example?
    We can put this attribute into good use by calling a simple js function and pass a reference of the element it self.
    <label for="toggleMoreBtns" onclick="changeValue(this);">+</label> Now define the function called changeValue in a <script> block just before the closing </body> element
    function changeValue (element) { if (element.innerHTML === '+'){ element.innerHTML = '-'; }else{ element.innerHTML = '+'; } } Updated fiddle: https://jsfiddle.net/Nillervision/9o2kf1h5/9/
  12. Nillervision's post in Automatically scroll to top onClick was marked as the answer   
    at the end of each click function try adding this:
    window.scrollTo(0, 0);
  13. Nillervision's post in iFrame tag not displaying properly was marked as the answer   
    OK wrap the iframe in an absolute positioned div like this
    http://jsfiddle.net/Nillervision/tw56u5pp/
  14. Nillervision's post in shtml vs php was marked as the answer   
    With PHP files you can use static HTML for script tags as well as any other elements.
    Just try to create an index.html and rename it index.php. It will run just fine (on a server).
    Just make sure that you open and close the php tags when you are typing your static HTML.
    If you only plan to use PHP to include elements you can do it like this:
    <!-- STATIC HTML--> <html> <head> <title>My Title</title> </head> <body> <header> <img src=”logo.png”> </header> <nav> <!-- NOW WE WILL OPEN A PHP BLOCK TO EXECUTE PHP--> <?php include_once 'includes/menu.html'; //NOW WE WILL CLOSE THE PHP BLOCK AND “ESCAPE” BACK TO THE STATIC HTML ?> </nav> <main> <h1>My heading</h1> <p>My Paragraph</p> </main> <aside> <!-- NOW WE WILL OPEN A PHP BLOCK TO EXECUTE PHP--> <?php include_once 'includes/sidebar.html'; //NOW WE WILL CLOSE THE PHP BLOCK AND “ESCAPE” BACK TO THE STATIC HTML ?> </aside> <footer> <!--SAME ROUTINE--> <?php include_once 'includes/footer.php'; ?> </footer> <script> //JAVASCRIPT </script> </body> <html> Make sure the files you include only contains the markup you need (no html, head, body etc.)
    so your menu.html would only contain something like this:
    <ul class=”menu”> <li><a href=”index.php”>Home</a></li> <li><a href=”about.php”>About</a></li> <li><a href=”contact.php”>Contact</a></li> </ul> If you need to print some static HTML without closing your PHP blocks you can use the echo function
    <?php echo '<p class=”myParagraph”>Some HTML</p>'; ?> Just remember that if you want to concatenate string data you must use a “.” instead of the “+” that you are used to in JS
    <?php $foo = 'A string variable'; echo '<p class=”myParagraph”>Some HTML containing '.$foo.'</p>'; ?> A final tip would be to turn on error reporting (only when developing though)
    To enable error reporting paste this code at the top of your documents
    <?php ini_set('display_errors',1); error_reporting(E_ALL); ?> There is an online PHP manual in many languages here
    http://php.net/docs.php
  15. Nillervision's post in Remove file extension from URL was marked as the answer   
    You can specify url rewrite rules in your .htaccess file
    https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/
  16. Nillervision's post in Where is the opaque coming from? was marked as the answer   
    Try to change line 56 in theme-1-structure.css from:
    background: transparent; to:
    background: white; That did the trick for me.
     
    But I can only agree with cibgraphics. Your CSS needs to be cleaner.
    Also: Is it really necessary with 16 stylesheets? Together with your 23 external js-files that is quite a lot of http requests to be executed.
  17. Nillervision's post in Display the value of a button when clicked. was marked as the answer   
    <html> <head> <title>Page Title</title> </head> <body> <button class="btn color1" id="btn-3" value="Color 1">1</button> <button class="btn color2" id="btn-4" value="Color 2">2</button> <p>30% = <span id="outputPrgf"></span></p> <script> var btns = document.getElementsByClassName("btn"); var outputPrgf = document.getElementById("outputPrgf"); for (i = 0; i < btns.length; i++) { btns[i].onclick = function(){ outputPrgf.innerHTML = this.value; }; } </script> </body> </html> EDIT: You probably allready have onclick functions for your buttons (if they do anything to your svg) so just add
    outputPrgf.innerHTML = this.value; to your existing onclick function
  18. Nillervision's post in Tabel width in large screens and mobile phones was marked as the answer   
    You could set the tables width in % with a maximum and minimum width
    table{ width:50%; max-width:600px; /*the width for big screens*/ min-width:400px; /*the width for small screens*/ } Don't no if it will work with your doctype though (for responsive websites you should use HTML5)
  19. Nillervision's post in javascript not working in Firefox? was marked as the answer   
    You need a link to the Jquery library. I can't seem to find it anywhere in your code
    Paste this within either your documents head or body element (somewhere before your gallery script)
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  20. Nillervision's post in Image in HTML5 not showing up was marked as the answer   
    Hmm. Here's a few more options you can check
    Option 1
    It might have something to do with IE security settings for displaying local media. Do you have access to a server so you can upload it and test it? if not try to reset the internet settings to default.
    Option 2
    There could be an old version of the site stored in IE's cache. Open IE press F12 (developer tools) and clear the cache.
    Option 3
    Are you sure the image is named with the correct extention "picture.jpg" and not "picture.jpeg"
    Option 4
    The image file could be dammaged. have you tried with another image?
  21. Nillervision's post in Seamless Tile Site was marked as the answer   
    I did a simple script a while back with just that purpose (no javascript knowledge is needed) just paste the script on your page and add some image links if you give them a:
    class="imgLink" then the image will be tiled when clicked
    Feel free to grab the source code here:
    http://www.nielsharbo.dk/resources/tileabletextures/textures-eng.html

  22. Nillervision's post in WordPress plugins, themes and validation was marked as the answer   
    Validation is just guidelines. But it’s good guidelines. There’s no problem with having a bunch of errors If you know why. Example back when we were coding in xhtml strict I would have a bunch of errors because the “target_blank” attribute was not allowed, but knowing that every browser would process them anyway it was safe to ignore those errors.
  23. Nillervision's post in What to do when jquery won't load? was marked as the answer   
    It's not necessary when you run from a server. But the http: is needed if you test locally. At least for me, i'm on windows

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.