some issues with bootstrap nav menu - php

I found some examples on bootstrap side and top navigation. I got it work almost as I would like to, but there are some things I can't make it work:
Here is jsFiddle of a working example.
1) How to add active class to a clicked item in the menu and remove active class from the one before?
2) How to change icon to down-arrow when expanding Menu and when closing back to left-arrow?
3) All examples which I found on the internet with admin panels similar to this one had independent pages. So if someone click Menu Item it loaded Head, body section and all the scripts again, so I decided to create one file with top and left navigation and only load content on menu item click like:
$(".side-nav a").click(function(e) {
e.preventDefault();
$("#page-wrapper").load($(this).attr("href")); //some filename.php
});
is this the right way to do it? (I noticed that I had to remove my .htaccess with Order deny,allow Deny from all)

For your first question, you should get from your php code the current page and compare it to the clicked link (a), so then you can check on the page load what link is active. if it is a one page with sections and each item is just pass the user to the anchor (of the item id) -> You should fix the code to be nicely, sorry, i have no time to make more then this now :(
$('.side-nav').on('click', function(e){
$('a').removeClass('active');
$(e.target).addClass('active');});
For your second question use the following css
[aria-expanded="false"] > i.fa-caret-left { transform: rotate(0deg); transition: all ease-in-out .4s; }
[aria-expanded="true"] > i.fa-caret-left{ transform: rotate(-90deg); transition: all ease-in-out .4s;}
For your third question, i'm not sure i understand what you try to do.
If i guess true, you are trying to inject "html" inside #wrapper element?
If so, yes, you can do so.
If you want to redirect to $(this).attr("href") link value, you should write it like this:
location.href = $(this).attr("href");
Hope i helped you.

Related

How to change element.style to none with css on all pages

guys I have a website on WordPress where I want to hide reviews tab on all product pages, currently I am using CSS hero to make changes but it applies only on the single page. I couldn't find a way to hide it on all pages, I can just do it by the changing element.style from block to none in inspect element, But I don't know how to apply it on my website. Here is the screenshot of the problem
Add this code to one of the public CSS that exist in all Pages.
.tab-content.tab-reviews {
display:none !important;
}
Do you have the same class name on other product pages too? If so, one way is to add a style:
.tab-reviews {
display: none !important;
}
classes may be repeated but ID's must be unique , please add your style with id like below
#content_tab_reviews {
display:none !important;
}
This will hide the class tab-content completely.
.tab-content{display:none !important;}

Can't figure out what is causing the side scroll on my website

I am building a website for some local business and I can't figure out what is causing the side scrolling. I must have been really tired and messed up somewhere. Any and all help would be wonderful. The link to the site is http://theparkwayrv.com
If you look, you'll see that there is a side scrolling bar. Please let me know if you can figure it out. I've gone over it like 10+ times and i'm losing my mind right now.
Thanks!
Add
body {overflow-x: hidden;}
to your CSS.
Generally, this is due to having items with width or min-width set to 100% or 100vw in your page. When the browser adds a vertical scrollbar to it (17px in Chrome), it makes it 100% + 17px, hence the need to add a horizontal scroll. This, however, doesn't happen on most mobile UI's and any browser that uses semi-transparent-show-on-scroll-only scrollbars.
As very well spotted by Tersosauros, the only one who, instead of providing a quickfix, like the rest of us, actually took the time to look for the real cause of your bodys extra width, in your particular case, this is due to using Bootstrap classes incorrectly. You used .row independently, without being a direct child of .container and the page is wider with 30px.
However, the quickfix still solves it. At least in this life, we're mostly payed for solutions, not for being right. Right? :)
This issue is being caused by the 15px left and right margins on .row (line #7, bootstrap.min.css) affecting the child div within the parkway_about_page div. This is part of how Bootstrap expects your page to be structured, as pointed out by #Andrei Gheorghiu . If parkway_about_page were also a .container bootstrap would fix this for you.
Either option fixed it for me:
Add (as the many other 1-line answers with no explanations have suggested) overflow-x: hidden; to #parkway_about_page.
--- OR ---
Remove the margin(s) from the .row div underneath parkway_about_page, (or just remove the class entirely).
Use this css to your body section:
body{overflow-x: hidden;}
Try this...
body {
overflow-x:hidden;
}
add this to your css file :
body{
overflow-x: hidden;
}
in body just put overflow-x: hidden

Using CSS for a link output by PHP?

Alright, so I have an HTML form and I want to be able to use that form to upload links to my database and then have the links displayed on an updated page. Everything works fine, but my issue is that whenever the link is retrieved and displayed from the database, I am unable to make changes to the CSS. For example:
This is a Great Site
is what I would enter into the form, this would be saved to the database, and the output would be:
This is a Great Site
my issue is, I am unable to change any of the link styles outside of color and other inline CSS options. I am unable to change things like what color it appears after the link has been clicked on, or what kind of action it does when hovered over.
What would be the easiest way to go about this? Is there a simple CSS workaround that I'm missing or am I going have to do something a little bit more complex?
Thanks in advance.
Assuming you show these links in a fixed place, add a class to the element that contains these links. This will safe you the trouble of adding a class to every link you add.
<div class="container">
This is a Great Site
</div>
Then you can change the CSS of these specific links with:
.container a {
color: green;
}
.container a:hover {
background: yellow;
}
I don't get your question.
Your link is 'www.stackoverflow.com'.
You output your link as
This is a Great Site
What prevents you from outputing a class or style attribute?
This is a Great Site
This is a Great Site
<a class="myOtherLinkClass" href="www.stackoverflow.com">This is a Great Site</a>
<style>
a.myOtherLinkClass,
a.myOtherLinkClass:hover,
a.myOtherLinkClass:active,
a.myOtherLinkClass:focus{
color: #d5d5d5; //Alternative add !important to the value
}
</style>
Try it like this. Be sure to put this into your .css-File without the <style> tags and put it after your "a"-Definition.

controlling links on right mouse clicks in my website

I've been searching for examples of custom on mouse right click menus but i would like to emulate the same options you get when you right click in chrome on a web page Maintaining cut, copy, and paste but also (here is the tricky part) instead of opening a new tab in your browser it opens the same webpage inside an iframe, option.
Thanks
Take a look at this plugin, it might help you
http://plugins.jquery.com/project/jqueryContextMenu
I would suggest hiding the "Window" which will be a div or some HTML element
Once user has right clicked on an element you can access it through jquery selectors and
enable it's visibility.
css:
#hiddenFrame {
display: none;
width: 250px;
height: 250px;
}
javascript:
menu1 = { attributes: "brief_number,brief_id,...",
items: [
{
type:RightContext.TYPE_MENU,
text:"some text",
onclick:function() {$('#hiddenFrame').show();}
}
]
};

jQuery toggle menu has issues with sub-item CSS

We had a bad experience with a developer not sticking to timelines and what-not so we had to drop them. That being said, we're completing the site on our own and only have a few items left. One of which is a JQuery based navigation toggle that he made... it works fine for the main level of items but when you get into sub menu items, it stops using the appropriate CSS. I'm thinking this is a basic "add this to CSS" answer, but I'm not versed in CSS well enough to figure it out.
The CSS and what I think is the JS calling it can be seen here: http://jsfiddle.net/C8vwJ/
The issue can be seen here: http://74.124.14.50/connecting-point/outreach/ (note the + "toggle open" graphic on the sub-item beneath "Outreach" is on the "Y" of "BeYond"... so it's not being CSS'd to the right as it should be.
Any ideas? Thanks for looking.
Add this line into your CSS file.
.widget-area .current_page_item .page_item .toggle { right: 0; }
Trouble in these lines of css code - style.css line 1291:
.widget-area .current-menu-item .toggle, .widget-area .current_page_item .toggle {
right: 10em;
}
If I try to change this value both '+' link and '-' link moving. Try to brake these properties. I tried to do
<div class="toggle" style="right: 0pt;"></div>
(this can be applied by classname, not inline css)

Categories