Backdrop for mobile with Javascript - javascript

I need this kind of behavior like when we click on make we can open the next model list in the same section
Please can you help me with how I can achieve this?

Im not sure about vanilla js but u can achieve this in ReactJS using react-router-dom package. you can add Link to each section which will replace that modal in the section without page reloading/refreshing.
Edit:
I have 2 ideas to to this with vanilla js but its a bit complicated and confusing.
using appenChild() change section child with onclick.
adding display: none to all and changing display: block for the once to display
this will not change reload or take to new page but u will need to add js for onclick for each route/model

Related

Same navigation bar in every page using JS

I know there is multiple ways to include a navigation bar using JS or JQuery and the script tag in the page you will use it,but for me ,this is not ideal,cause once you use the script tag,you can no longer use JS in your page.Is there a way you can create a nav-bar using js,(f.e. navbar.js), then lets say for example i have a frontpage.html with src="frontpage.js" and in frontpage.js,i can use require('./navbar.js') that will create my navbar.
$(function(){
$("#nav-placeholder").load("req/nav.html");
});
You can use this technique in Jquery. Just Simple.

Javascript bookmarklet to remove navbar?

I am trying to create a javascript bookmark that will remove a side navbar from a website that I use, but cannot seem to be able to remove it.
The navbar element id I would like to hide is is:
ul.nav.navbar-nav.side-nav.col-md-2
I have tried a few ways from researching online, but with no luck. How can I accomplish this?
Here is my attempt:
javascript:(function(){('ul.nav.navbar-nav.side-nav.col-md-2').hide()})();
This is an internal portal website that I use.
I am trying to modify/remove the menu once the site is loaded via the browser in the form of a javascript bookmarklet, and am not editing the site's code myself.
Without an example of the problem or website it won't be very clear/easy for anyone to help.
But one obvious issue I see is that you are not actually referring to an element directly, you just placed a CSS selector in brackets:
('ul.nav.navbar-nav.side-nav.col-md-2')
You probably want to use jQuery to get the element:
$('ul.nav.navbar-nav.side-nav.col-md-2')
Or if jQuery is not available:
document.querySelector('ul.nav.navbar-nav.side-nav.col-md-2').style.display = 'none';

Don't display anything below some element

is it possible to hide every content after a certrain element (e.g. after a certain class of div)?
The problem is: I'm using a 1&1 webpage builder with a layout-template (annoying like hell) because of my boss. I'd like to remove the footer, but nothing has worked yet as it seems that the template prevents me from hiding the footer with simple CSS (I'm happy for any suggestions here as well).
But maybe it's possible to hide anything that comes after a certain element like a div or image (or whatever) so that I can put the element right before the footer?
Thanks in advance.
You should be able to use JS if it is possible on 1&1.
As you probably have JQuery you can do it like this:
$('.footer-class').remove();
or
$('.footer-class').css('display', 'none');
I don't think that 1&1 would have different classes or ids for footers each time someone refreshes it, so I think it should work.
Please provide a working example or your website address. This will help us.
Can you give us the footer's classes, id and all attributes? The simplest solutions is style="display:none" added to the footer

Change main content on a webpage using bootstrap

I am building a webpage using Bootstrap 3. I am trying to find the best way to change the main content of the side. I have a Header, left content and right content but I want to change the middle content by pushing a button without changing the surrounding elements. What would be the best thing to use to accomplish this. Is there some demos online that someone can point out? I have been trying to find some but without luck.
Bootstrap doesn't have that feature. First try to learn what bootstrap can do or can't, what bootstrap made for.
What you are trying to do is called templating. You can use php, ajax or other methods to dynamically add content to your content section of your template.
You have many ways to do that, maybe with jQuery .load() and maybe combined with HTML5 history API or some other framework...
But Bootstrap has nothing to do with that..
You can start reading about AJAX and DOM manipulation first, but here is some link you can use:
Dynamically Loading Content in Twitter Bootstrap Tabs
You cannot do that with boot strap that is just not what it's made for you can use either PHP or Ajax personally if you know PHP already and have everything set up for go with that because in my opinion Ajax sucks to learn and work with

bootstrap component's navigation sidebar + animated section indicator

I've been trying for weeks to build a navigation sidebar like these images:
I'm using twitter bootstrap, however, even though their getbootstrap.com/components has a very good looking navigation sidebar, there is no such component in their library and it is so much pain to build one. Therefore, I resorted to using jquery in my attempt to build one like the Tommy Hilfiger's global site.
Tommy Hilfiger's Global Site
However, I'm new with javascript and css... they are my weakpoints... especially if they are minified :( and I'm stuck at trying to make the arrow marker and have it move along (animating) and always pointing to the current section. I managed to animate the page scrolling though, and my WIP so far is here:
WIP - Twitter Bootstrap Navigation Sidebar
Is there any open source components (or preferably bootstrap ones) to achieve that section indicator animation?
I'm so confused with my scripts that are getting messier, so open source component is highly desireble, however, any input on how to achieve it (with script example please) will also be appreciated.. Thank you very much in advance!
Check out ScrollSpy, the component exist on bootstrap itself:
bootstrap scrollspy
extracted from:
https://stackoverflow.com/a/14366014/474330
So you need to use the scroll spy activate event described here:
http://twitter.github.com/bootstrap/javascript.html#scrollspy
Basically you need some code like so:
$(function() {
var $spy = $('.nav.nav-pills');
$spy.scrollspy({offset: 20});
$spy.bind("activate", function(e) {
// do stuff here when a new section is in view
});
});
Here is a working example:
http://jsfiddle.net/hajpoj/f2z6u/3/
please ignore the fact that it starts at the bottom... not sure if that a unrelated or related bug, but the main point is you can see how the activate event works

Categories

Resources