sIFR onReplacement example - sifr

Can someone show me the proper way to invoke the onReplacement callback within sIFR.replace?
Here's my current sIFR.replace method call:
sIFR.replace(mainNavFont, {
selector: 'a.nav-item',
css: '.sIFR-root { color: #ffffff; cursor:pointer;}',
wmode:'transparent',
fitExactly: true,
tuneWidth:10,
offsetLeft: 5,
forceSingleLine: true
});

Like this:
sIFR.replace(mainNavFont, {
selector: 'a.nav-item',
css: '.sIFR-root { color: #ffffff; cursor:pointer;}',
wmode:'transparent',
fitExactly: true,
tuneWidth:10,
offsetLeft: 5,
forceSingleLine: true,
onReplacement: function(fi) {
// Movie has been replaced
}
});
Also, you'll find that replacing the <a> directly will break the links in most browsers. You have to replace the parent element such that the link ends up inside the Flash movie.

Related

Set custom color for highcharts-halo in styled mode

I am using Highcharts 6.0.1 in styled mode and trying to set a custom color for a specific point and the correspondent halo.
I need to be able to dynamically append a class name to some of the points in the series. These points need to be displayed in a different color, thus overriding the default series colors (.highcharts-color-i).
I managed to override the color of a specific the point, as the point object accepts an optional className which can then be used to style the color of the slice in the pie chart.
The css rule for the halo though, is set to inherit the color of the correspondent .highcharts-color-i and since it is not a child element of the point it cannot inherit the custom class name.
Here is a code snippet. You can see that when hovering over the grey slice, the halo is using the default color.
Highcharts.chart('container', {
title: {
text: 'Pie point CSS'
},
tooltip: {
pointFormat: '<b>{point.percentage:.1f}%</b>'
},
series: [{
type: 'pie',
keys: ['name', 'y', 'className'],
data: [
['Point1', 29.9,],
['Point2', 14.5],
['Point3', 11.5],
['Point4', 54.5, 'custom-style'],
],
}]
});
#import 'https://code.highcharts.com/css/highcharts.css';
#container {
height: 400px;
max-width: 800px;
min-width: 320px;
margin: 0 auto;
}
.highcharts-tooltip {
stroke: gray;
}
.highcharts-pie-series .highcharts-point {
stroke: #EDE;
stroke-width: 2px;
}
.highcharts-pie-series .highcharts-data-label-connector {
stroke: silver;
stroke-dasharray: 2, 2;
stroke-width: 2px;
}
.highcharts-pie-series .highcharts-point.custom-style,
.highcharts-pie-series .highcharts-data-label-connector.custom-style {
stroke: lightgray;
stroke-dasharray: white;
stroke-width: 1px;
fill:lightgray;
}
<script src="https://code.highcharts.com/js/highcharts.js"></script>
<div id="container"></div>
Halo is a property of a series (not a point - only one halo can exist per series). In DOM tree it's on the same level as the rest of the points.
You can use point's mouseOver event for setting the color of the halo:
plotOptions: {
series: {
point: {
events: {
mouseOver: function() {
var point = this,
className = point.className;
if (className) {
point.series.halo.attr({
class: 'highcharts-halo custom-style'
});
}
}
}
}
}
}
.highcharts-halo.custom-style selector is used for styling via CSS.
Live demo: http://jsfiddle.net/kkulig/fv0zen7L/
API reference:
https://api.highcharts.com/highcharts/plotOptions.pie.events.mouseOver
https://api.highcharts.com/class-reference/Highcharts.SVGElement#attr

sIFR element with class

I'm having difficulty with sIFR 3. I am creating some pagination. I would like the element with an 'active' class to be a different color. This is not working. The rest of the code is working fine including the rollover color.
Here's my code. If anything is out of place please let me know.
sIFR.replace(uni, {
selector: 'div.pag_holder',
css: [
'.sIFR-root { background-color: #DEDEDE; }'
,'a.active { color:#000000; }'
,'a { text-decoration:none; color:#1c4382; }'
,'a:hover { cursor:pointer; color:#000000; }'
]
});
I've tried playing around with the order of those anchors, but to no avail.
We had a similar problem where sIFR doesn't implement the value given in a class when the element style has also been specified. The answer was to use two classes for the anchor element. So you could try:
sIFR.replace(uni, {
selector: 'div.pag_holder',
css: [
'.sIFR-root { background-color: #DEDEDE; }'
,'.navLinkActive { color:#000000; }'
,'.navLink { text-decoration:none; color:#1c4382; }'
,'a:hover { cursor:pointer; color:#000000; }'
]
});
Hope this helps.

sIFR 3 and Links: can't get them to work together

I am trying to use font replacement for my links, but have no idea how to do it.
My test site is http://www.internetlinked.com/test/ how do I setup sifr-config.js so that the links on the left have their fonts replaced. I go it to work using
sIFR.replace(decade, {
selector: 'li',
css: '.sIFR-root { background-color: #1A171B; }'
});
But then I lost all the hover affects and borders
using
sIFR.replace(decade, {
selector: 'a',
css: '.sIFR-root { background-color: #1A171B; }'
});
results in the replacement but the links don't work
I am using sIFR 3
Your first approach is correct. You can style the link by adding rules to the sIFR CSS:
sIFR.replace(decade, { selector: 'li', css: '.sIFR-root { background-color: #1A171B; } a { color: #FF9900; a:hover { color: #FF0000; }' });
Borders and such would be trickier, since Flash doesn't natively support these. Looking at your design, I would not recommend using sIFR for the links in the sidebar.

SIFR 3 NOT RENDERING IE7

I am building a site right now using the new siFR3 it works perfectly on FF & Chrome but not on IE7 to view click here
Try fixing the errors: Here and see if that helps.
Making sure your site is W3C compliant can be a major help in fixing troublesome quirks.
Make sure there is no trailing comma before a closing brace in the config. These are illegal in IE's JavaScript engine.
ok I found out what was the problem all it was watch my old code that doesn't work in IE:
sIFR.replace(officinaWhite, {
selector: '#boxes h1', wmode: 'transparent',
css: '.sIFR-root { color:#ffffff; }',
});
sIFR.replace(officina, {
selector: '#content h2, #rightCol2 h2, #rightCol h2', wmode: 'transparent',
css: '.sIFR-root { color:#000000; }',
});
and this is the code that fixed it:
sIFR.replace(officinaWhite, {
selector: '#boxes h1', wmode: 'transparent',
css: ['.sIFR-root { color:#ffffff; }']
});
sIFR.replace(officina, {
selector: '#content h2, #rightCol2 h2, #rightCol h2', wmode: 'transparent',
css: ['.sIFR-root { color:#000000; }']
});
it is only missing the parenthesis under the css:['.sIFR-root { color:#000000; }'] no commmas in the end.

sifr links color not changing

I've tried to replace the styles of link on my site, and it seems like the font face is replaced successfully, but it's not taking in the color and text-decoration. Here is my script:
<script type="text/javascript">var archermed = {src: 'archermed.swf'}; sIFR.activate(archermed);sIFR.replace(archermed, {selector: '.CollectionTopTabHdr',css: '.sIFR-root {font-size:14px; color:#663399; text-decoration; font-weight:normal; margin:0;} a, a:link, a:visited, a:active {color:#663399; text-decoration:none;}',wmode: 'transparent'});</script>
here is my HTML code:
<div class="CollectionTopTabHdr">LINK</div>
Thanks in advance!
18fis
I found out from another question that I need to separate out the link states in css, so here is what I did, and it works now!:
sIFR.replace(archerbold, {selector: '.sifrHeader',css: ['.sIFR-root { font-size:14px; color: #663399;}','a { text-decoration: none; color: #663399; }','a:link { color: #663399; }','a:hover { color: #663399; }','a:active {color:#663399;}'],offsetTop: -1, tuneHeight: 0,wmode: 'transparent', forceSingleLine: true});

Resources