AngularJS broken JQuery animations - javascript

I'm a new angularjs student, and i was making my menu with ng-repeat.
I made a template too, but when i debug my code, all jquery animations are gone. All menus are inside of my div's with jquery animations.
<nav class="navbar-default navbar-static-side" role="navigation">
<div class="sidebar-collapse">
<ul class="nav metismenu" id="side-menu">
<webapi class="nav metismenu sidebar-collapse"></webapi>
</ul>
</div>
</nav>
This is my HTML, the repeat with a template only works with bootstrap CSS style, but all animations are gone.
Can anyone help me, please?
Thanks a lot!
https://plnkr.co/edit/BCmH9wnXXQzd7wntsrZl?p=preview

Your plunk doesn't work because you're mixing http and https. The insecure content (jQuery and the font) is blocked.
I updated your code to reference https, commented out the missing plugins, added in AngularJS 1.5 for the existing menu items so you should be able to compare that with your attempt:
https://plnkr.co/edit/IunNO1j4mvueK6BawPa5?p=preview

Related

I can't get scrollspy to work with my bootstrap navbar

I know this is a very common problem, but I have spent ~two days crawling the forums, trying fixes, can't seem to find the answer.
I have a standard bootstrap setup that uses some parallax scrolling. I have a navbar fixed to the bottom of the page. Each <li> is shaped like a circle, and inside the <li> is an <a> tag. Each 'circular' <li> is linked to an anchor tag on the page in order to provide navigation around the page. This is a one-page template set up.
Here is a fiddle:
https://jsfiddle.net/k8g3qydw/1/
I have the bootstrap.css and .js files properly enqueued, I added data-target=".scrollspy" data-spy="scroll" data-offset="0"
to the body tag and added the class .scrollspy to the parent element of my <ul> like so:
<div class="scrollspy board-inner">
<ul class="nav nav-tabs" id="myTab">
<div class="liner"></div>
<li class="nav-item active">
So, I am pretty confused as to what to do!
Any help is much appreciated!
There are multiple mistakes in your code.
You should use one method to add Bootstrap ScrollSpy to your page, not both:
via Data Attributes or JavaScript. So you should delete your body attributes or javasript line $('body').scrollSpy({...});
ID attribute must be unique to the whole document. You have repeated IDs on page. And.. In wrong place. On working fiddle #spy was assigned to nav wrapper, since it is the one which is being spied.
Navbar links should point to "resolvable id targets" instead of <a name="service">. You should use <a id="service">.
And also make sure that bootstrap.min.js is included after jQuery in your document. Since jQuery is required for Bootstrap, not other way.
Here is a working JSFiddle

Is it possible for Bootstrap navbar to work the same way as bootstrap tabs?

By this I mean, is it possible to loads the different links dynamically, like you would with the tabs? I don't want any loading to take place, just for the content to show immediately.
Exactly like in the Bootstrap Tabs documentation: http://getbootstrap.com/javascript/#tabs
Is this possible?
Just use the Bootstrap navbar styles:
<ul class="nav navbar-nav">
instead of:
<ul class="nav nav-tabs">
Here is the updated jsfiddle.

Attached to Detached Navigation Issue

I am currently building my personal portfolio and, not having a lot of practical knowledge in javascript, but having gone through a lot a tutorials, I decided to try to implement something I saw elsewhere: A detachable navigation.
Using this site, http://code.stephenmorley.org/javascript/detachable-navigation/, as a reference I set about creating my detaching navigation; however, something went horribly wrong.
For one, the header will automatically align to the left rather than returning to its default position.
Second, although you can't yet see it implemented, I wanted the social icons to show up in the navigation once they were scrolled past using an animation. That bit of code was so convoluted that I scrapped it.
Any pointers would be greatly appreciated.
Why not just use Bootstrap? It has this built in already: http://twitter.github.com/bootstrap/components.html#navbar
Download bootstrap: http://twitter.github.com/bootstrap/assets/bootstrap.zip
Add the bootsrap Javascript and CSS to your page.
In your HTML, add the following DIV:
You can change the div to fit your needs.
<div class="navbar navbar-fixed-top">
<li class="active">
Home
</li>
<li>Link</li>
<li>Link</li>
</div>

twitter bootstrap popover displaying but looks weird - rails

Hi I'm using twitter bootstrap popover functionality with seyhunak / twitter-bootstrap-rails gem.
I have the following code in my view:
<ul class="nav nav-pills subnav">
<li>
<a class="label-with-popover" data-content="popover content" data-title="popover title">Home Valuations:</a>
</li>
</ul>
The following in my page.js.coffe
jQuery ->
$('.label-with-popover').popover()
The popover appears but looks like so:
Bootstrap popover displays weird with extra vertical line through it: does anyone know how I can fix this?
Let me know if you need more info.
You've got a bunch of collisions between Bootstrap CSS and the CSS you wrote for your project. In the future, you should consider using a namespace for your own general-purpose classes like .arrow, or your CSS will interfere with third-party libraries (like Bootstrap) which use such common class names.
Here's an edit to your fiddle: http://jsfiddle.net/5rT9t/1/
I removed the margin declaration on .content, the padding values on .arrow, and, strictly for demo, added a container div to offset the popover so you could see the whole thing.

Specify spinner while loading content with Rails UJS

I'm using Rails UJS to load partials into a container depending on the link I click. I've got everything working (see my answer to my question here for code) but I'd like to add a spinner while the content is loading. How can I go about doing this? I found a brief example in Simone Carletti's post on UJS but can't seem to implement it properly.
Here's the HTML generated:
<div id="tabs">
<ul id="infoContainer">
<li>Reviews</li>
<li>About</li>
<li>Credits</li>
<li><span id="loading">Loading...</span></li>
</ul>
<div id="tabs-1">
# load data from partials here
</div>
</div>
Can anyone help me out?
See this SO answer for more info, but the easiest thing to do is to bind to the ajax:before and ajax:after events to show/hide the spinner.
Whether to do this via the javascript_event_tag or by binding in an external JS file is a different issue.

Categories