How can I check with JS if the Magellan bar (or the element I added "data-magellan-expedition='fixed'") is sticky while scrolling?
I want to add a class if it's sticky. Otherwise the class should be removed.
Adding the below script end of page (with the other scripts) then using the .navstuck class in my SCSS worked for me:
<!--for Sticky Nav per http://codepen.io/zurbchris/pen/rxMaoX-->
<script>
$(document).foundation();
$('.sticky').on('sticky.zf.stuckto:top', function(){
$(this).addClass('navstuck');
}).on('sticky.zf.unstuckfrom:top', function(){
$(this).removeClass('navstuck');
})
console.log(Foundation.version);
</script>
when the sticky is activated the div gets a css attr of
style="position: fixed; top: 0px;"
thus you can use that to add a class
if ($('#yourElement').css('position') == 'fixed')
{
// true
}
Related
Microsoft have announced it is possible to turn off the loading image shown when a report is loading.
Loading Image
Use the Power BI Embedded JavaScript SDK to hide the flickering Power
BI logo that appears when a report is loaded. - power-bi-embedded-feature-hide-the-power-bi-logo-during-visualization-load
However I cannot find any mention of this in any of the JS SDK documentation or any examples online.
Has anyone achieved this yet?
First add a gif which you want instead of the Power BI logo. You can add it in a div element. This element will overlap the div element containing the report. The HTML code looks like below:
<div id="container">
<div id="overlay">
<img id="spinner" alt="Alternate Text" src="image/giphy.gif"/>
</div>
<div id="embedContainer" style="height: 600px; width: 100%; max-width: 1400px;">
</div>
</div>
Once you have added your gif. Now, make changes in the JavaScript Code. So you final JavaScript embedding code will be:
<script type="text/javascript">
// Read embed token
var embedToken = "<% =this.embedToken %>";
// Read embed URL
var embedUrl = "<% = this.embedUrl %>";
// Read report Id
var reportId = "<% = this.reportId %>";
// Get models (models contains enums)
var models = window['powerbi-client'].models;
// Embed configuration is used to describe what and how to embed
// This object is used when calling powerbi.embed
// It can also include settings and options such as filters
var config = {
type: 'report',
tokenType: models.TokenType.Embed,
accessToken: embedToken,
embedUrl: embedUrl,
id: reportId,
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: false
}
};
$("#embedContainer").css("visibility", "hidden");
// Get a reference to the embedded report HTML element
var reportContainer = $('#embedContainer')[0];
// Embed the report within the div element
var report = powerbi.embed(reportContainer, config);
report.on("loaded", function (event) {
$("#overlay").hide();
$("#embedContainer").css("visibility", "visible");
report.off("loaded");
})
</script>
You can also add CSS to align you gif with your report:
<style>
#container{
position:absolute;
width: 1400px;
height:600px;
}
#overlay{
position:absolute;
width:inherit;
height:inherit;
}
#spinner{
display: block;
margin-top:10%;
margin-left: auto;
margin-right: auto;
width:10%;
height: 10%;
}
</style>
Further, you can refer to the following youtube link: https://www.youtube.com/watch?v=YhjtunTmnbw. This video is by the Power BI official YouTube account. In this video, you can learn how to get white-labelled embedded analytics in your application with Power BI Embedded. Discover how to hide the Power BI logo until the loaded or the rendered event, and how to use a personalized logo for the loading phase.
What the recommended way to do this, even in the article you referenced, is -
1. Hide the iframe (or the div containing it)
2. Listen to either the loaded event when using (phased loading)[https://github.com/Microsoft/PowerBI-JavaScript/wiki/Phased-Embedding-API] or rendered otherwise
3. Show the div you hid before and voila - the embedded power bi is already loaded..
It is not currently possible to remove the PowerBI loading symbol. It would be great idea to suggest to input your own custom logo though
I'm trying to change the default color for my title, which is white at the moment.
<nav class = "top-bar" data-topbar>
<ul class = "title-area">
<li class = "name">
<h1><%= link_to "CF logo", root_path, class: "home"%></h1>
</li>
</ul>
</nav>
I tried calling
.name h1{
color:red;
}
and
.title-area .name h1{
color:red;
}
even
.home{
font-size: 1.5em;
font-color: red;
}
but none of them works. What can I do?
If your title is inside of an anchor tag <a> - you'll want something like this:
.top-bar .name a { color: #9dcf81; }
Inside Chrome, after you inspect your element, look for the plus symbol once you highlight your title with a mouse click. Consider using the !important attribute if the color doesn't stick.
p.s. - Please provide a link with a URL Shortening service (if your concerned about privacy) to your site.
Whether or not a CSS rule is used is dependent on the selectors specificity. See the MDN for details on how specificity for a CSS selector is calculated.
If you want to see which CSS statement is overriding your one (presumably one of the styles specified in the Foundation CSS library that you are using), then I would recommend a tool like firebug or chrome developer tools which allow you to inspect an element and see which rules are being taken into account and which are being overridden by more specific selectors.
You can also use important! inside a selector to override the specificity, however use this with caution. So for example:-
.name h1 {
color:red !important;
}
I've been banging my head against this for over a day and no amount of experimenting, Google'ing, or Stack Overflow searching has helped.
I'm developing an Ember/Vert.x app that has one Ember Route that accepts "real-time" push-data via SocksJS. This is working beautifully, including the successful implementation of dynamic (Ember) templates.
What I need now is the ability to set styles on the rootElement (rootElement is body). I've tried umpteen different approaches, including resorting to jQuery calls. Nothing will place a style on the body tag. I CAN get the style attribute set on the 1st div inside the body tag by doing:
App.ApplicationView = Ember.View.extend({
attributeBindings: ['style'],
style: "background-color: blue; background-image: url('" + App.currentProgram.backgroundImage + "')"
});
This renders:
<div id="ember325" class="ember-view" style="background-image: url('img/bg/1.png')">...</div>
However, I really want to style the body tag dynamically.
Any help would be GREATLY appreciated as this is a blocking item for my prototype client demo next week.
You can use the didInsertElement method, to know when the dom is inserted, and update the body element using this.$().parent().
App.ApplicationView = Ember.View.extend({
didInsertElement: function() {
this._super();
this.$().parent().css({
"background-color": "blue",
"background-image": "url('" + App.currentProgram.backgroundImage + "')"
});
}
})
Live sample http://jsfiddle.net/X5TmH/
Foundation default tooltips look like this:
I'd like to get rid of the small top triangle on parts of my website.
To get rid of it everywhere you just have to change the $tooltip-pip-size variable value to 0 from the foundation_and_overrides.scss file (also called _settings.scss if you're not using the foundation gem with rails).
Is it possible to define a custom version of the foundation tooltip without a pip?
EDIT
The difficulty here is that when I write something like
<span data-tooltip class="has-tip tip-bottom" title="Here are my tooltip contents!">extended information</span>
Foundation javascript generates a specific element at the end of the document containing the actual tooltip:
<span data-selector="tooltip8vxaud6lxr" class="tooltip tip-bottom" style="visibility: visible; display: none; top: 78px; bottom: auto; left: 50px; right: auto; width: auto;">Here are my tooltip contents!<span class="nub"></span></span>
You see that the tip-bottom class I added to the first span got copied to the second but that is only the case for foundation specific classes like tip-left, tip-right and so on.
What I would like to do is being able to add a "no-pip" class to the first span (the only one I actually write) and be able to alter the look of the generated span containing a "nub" element.
<span data-tooltip class="has-tip tip-bottom no-pip" title="Here are my tooltip contents!">extended information</span>
Just hide it by setting display property to none
.tooltip > .nub {
display: none;
}
that little triangle is just span with class nub all what you need to do is to remove the css border from it then you 'll have your tool tip in the same location as normal without the little triangle
With foundation version 5 you can customize the tooltip template.
Just remove the <span class="nub"></span>:
$(document).foundation({
tooltip: {
tip_template : function (selector, content) {
return '<span data-selector="' + selector + '" class="'
+ Foundation.libs.tooltip.settings.tooltip_class.substring(1)
+ '">' + content + '<span class="nub"></span></span>';
}
}
});
We're having trouble getting some form of visual indication that a 'page' is loading in our Ember App.
Tried both a gif method and also Spin JS. Both fail as they are very laggy and only fully load when all the Ember objects have loaded. A similar problem to this question.
What methods are other people using in their public facing builds?
Edit: This is when the app is loading for the first time. The initial load is long enough to require some form of visual indication.
You could add an overlay to your document with an loading indicator. When you add it via CSS it is loaded before Ember is initialized. After ember is initialized you could remove the overlay.
Below an example how I might implement it:
HTML:
<html>
<head> ... load dependencies ... </head>
<body class="loading"> ... handlebars templates ... </body>
</html>
CSS:
body.loading:after {
content: '';
background: rgba(255,255,255,.3) url(images/loader.gif) 50% no-repeat;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 10;
}
Ember code:
App.ApplicationView = Ember.View.extend({
removeLoader: function() {
$('body').removeClass('loading');
}.on('didInsertElement')
});
This way before Ember is initialized an loading indicator is showed, but when Ember is done initializing the loader is removed.
You can use jQuery ajax callbacks for this:
$(document).ajaxStart(function(){ console.log("ajax started")})
$(document).ajaxStop(function(){ console.log("ajax stopped")})
This will work for all ajax requests.