Make ScrollMagic pause while animation is happening, then go to next scene - scrollmagic

I have a ScrollMagic scene with a bunch of animations on it. The problem is that the controller doesn't seem to recognize the scene. It scrolls right past it onto the following scene. How can I make the scene with animation pause until the animation is finished? I've tried all kinds of variables in duration and none seems to work.
html:
<div class="screen" id="scene4"><!-- does not pause, scrolls right past-->
<div id="pinned">
<div id="third" class="img"></div>
<div id="second" class="img"></div>
<div id="first" class="img"></div>
</div>
<div class="story-content" id="chunk1">
<!-- a block of text here-->
</div>
<div class="text" id="VFD735">
<!-- a block of text here-->
</div>
</div>
<div class="screen" id="scene6">
<!-- full screen image -->
</div>
css:
.screen {
position: relative;
width: 100%;
z-index: 100;
float:left;
}
#pinned {
width: 100%;
height: 100%;
position: absolute;
left:0; top: 0;
}
.img {
position: absolute;
width: 100%;
height: 100%;
background-size: cover;
background-position: center center;
}
#first {
background-image: url('../img/web-EMS-01.jpg');
}
#second {
background-image: url('../img/web-EMS-02.jpg');
}
#third {
background-image: url('../img/web-EMS-03.jpg');
}
scrollMagic:
//pin container
var scene = new ScrollMagic.Scene({
triggerElement: "#pinned",
duration: '500%',
triggerHook: 0,
reverse: true
})
.setPin("#pinned").addTo(controller);
var tweenScene1 = new TimelineMax()
.to('#VFD735', .5, {opacity: 1, delay: .5}
)
.to('#chunk1', .5, {opacity: 1, delay: 1.2}
)
.to("#first", 1, {opacity: 0, delay: 2}
)
.to('#second', 1, {opacity: 0, delay: 2.5}
);
var scene = new ScrollMagic.Scene({
triggerElement: '#pinned',
reverse: true
})
.setTween(tweenScene1)
.addTo(controller);
//pin scene6
var scene = new ScrollMagic.Scene({
triggerElement: "#scene6",
duration: $(window).height() * 2,
triggerHook: 0,
reverse: true
})
.setPin("#scene6").addTo(controller);

The answer is, you have to insert additional empty containers, each with a specified height, after the scene with the animation so that nothing happens until the animation is done.
<div class="screen bg-transparent height100" id="">
<div id="second" class="img"></div>
</div>
<div class="screen bg-transparent height100" id="">
</div>
<div class="screen bg-transparent height100" id="fade2">
</div>
<div class="screen bg-transparent height100" id="">
</div>
<div class="screen bg-transparent height100" id="">
<div id="third" class="img"></div>
</div>
<div class="screen bg-transparent height100" id="">
</div>
<div class="screen bg-transparent height100" id="fade3">
</div>
<div class="screen bg-transparent height100" id="">
</div>
<div class="screen bg-transparent height100" id="">
</div>
<div class="screen bg-transparent height100" id="">
</div>
.screen {
position: relative;
width: 100%;
z-index: 100;
float:left;
}
.height100 {
height: 100vh;
}
#second {
background: url('../img/web-02.jpg') no-repeat top left;
width: 100%;
height: 100%;
overflow: hidden;
opacity: 0;
}
#third {
background: url('../img/web-03.jpg') no-repeat top left;
width: 100%;
height: 100%;
overflow: hidden;
opacity: 0;
}
var scene = new ScrollMagic.Scene({
triggerElement: "#second",
duration: height*9, //make it stay around
triggerHook: 0,
reverse: true
})
.setPin("#second").addTo(controller);
var fadeUp02 = TweenMax.to('#second', 1.5, {opacity: 1}); //fade in timestamp1
var scene = new ScrollMagic.Scene({
triggerElement: '#fade2' //have some empty screens pass before activate
})
.setTween(fadeUp02)
.addTo(controller);
var scene = new ScrollMagic.Scene({
triggerElement: "#third",
duration: height*6,
triggerHook: 0,
reverse: true
})
.setPin("#third").addTo(controller);
//keep going

Related

Resize map marker in NG-Map (AngularJS)?

I am trying to resize my map icon with scaledSize however the icon does not change, here is my code:
This works:
<marker icon="{resource.marker_circle}" class="marker-icon" id="{resource.id}" position="{resource.address}" title="{resource.name}" id="resource_clicked" value="{resource.id}"
on-mouseover="showInfoWindow(event, '{resource.id}')">
But when I try to resize the icons, it does not work with scaledSize:
<div class="map-container">
<div style="margin: 0 auto; overflow:hidden; background: white;">
<div style=" width: 100%; margin:center; height: 257px; border: none; border-radius: 25px;" map-lazy-load="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY">
<ng-map ng-map-custom style="width: 100%;height: 100%;border: none; border-radius: 25px;" center="Santa Ana, CA" zoom="11">
{!resources.filter('category_ref', _equals(my.category)).each(per_page: 30, page:response._page_44_resources_repeatingsection1) do |resource|}
<marker icon="{url: resource.marker_circle, scaledSize:[32,40], origin: [0,0], anchor: [16,40]}" class="marker-icon" id="{resource.id}" position="{resource.address}" id="resource_clicked" value="{resource.id}"
on-mouseover="showInfoWindow(event, '{resource.id}')"></marker>
<info-window id="{resource.id}" max-width="300" style="display: none;">
<div ng-non-bindable="">
<div id="siteNotice"></div>
<a href="" response-click="go">
<h3 id="firstHeading" class="firstHeading">Location - # of Searches</h3>
</a>
<div id="bodyContent">
<p>
{resource.city}
</p>
</div>
</div>
</info-window>
{!end}
</ng-map>
</div>
</div>
</div>

keep highcharts legend responsive when another div lies over chart

I want to display html buttons in the four corners of a HighCharts polar chart's margins. I was able to layer the buttons over the chart div using css. However, doing this results in the chart legend items not responding to mouse clicks.
This is an example of the code for one of the buttons:
<div className="pop-chart-button pop-chart-button-top pop-chart-button-left">
<a role="button" onClick={this.showBrandQuadrantChart}>
<img src={expandImageUrl} alt="expand" /> BRAND
</a>
</div>
Is there some way to accomplish this that does not make the legend items unresponsive to mouse clicks?
Just by guessing without seeing your CSS code, the buttons z-index is underneath the chart. Setting the buttons to a higher z-index will probably fix the issue.
Solved my problem by setting a z-index for both chart and button divs and putting the chart div after the div containing the buttons.
Here are the scss styles:
.pop-kahn-chart-container {
position: relative;
.pop-chart {
z-index: 99;
}
.pop-chart-buttons {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
.pop-chart-button {
font-family: 'Montserrat', sans-serif;
font-style: normal;
font-size: 0.86rem;
font-weight: 600;
position: absolute;
z-index: 9;
a {
border-radius: 2px;
padding: 2px 8px;
color: $bp-green;
}
a:hover {
background-color: $bp-gray2;
}
img {
width: 19px;
height: 19px;
vertical-align: center;
position: relative;
top: -3px;
}
#include media-breakpoint-down(lg) {
font-size: 0.6rem;
img {
width: 14.25px;
height: 14.25px;
top: -2.25px;
}
}
}
.pop-chart-button-top {
top: 10%;
}
.pop-chart-button-bottom {
top: 85%;
}
.pop-chart-button-left {
left: 5%;
}
.pop-chart-button-right {
left: 75%;
}
}
}
Here is the code that renders the chart with overlaid buttons:
<div className="pop-kahn-chart-container">
<div className="pop-chart-buttons">
<div className="pop-chart-button pop-chart-button-top pop-chart-button-left">
<a role="button" onClick={this.showBrandQuadrantChart}>
<img src={expandImageUrl} alt="expand" /> BRAND
</a>
</div>
<div className="pop-chart-button pop-chart-button-top pop-chart-button-right">
<a role="button" onClick={this.showExperienceQuadrantChart}>
<img src={expandImageUrl} alt="expand" /> EXPERIENCE
</a>
</div>
<div className="pop-chart-button pop-chart-button-bottom pop-chart-button-left">
<a role="button" onClick={this.showLowPriceQuadrantChart}>
<img src={expandImageUrl} alt="expand" /> LOW PRICE
</a>
</div>
<div className="pop-chart-button pop-chart-button-bottom pop-chart-button-right">
<a role="button" onClick={this.showFrictionlessQuadrantChart}>
<img src={expandImageUrl} alt="expand" /> FRICTIONLESS
</a>
</div>
</div>
<div className="pop-chart">
<HighchartsReact highcharts={Highcharts} options={options} />
</div>
</div>

Angularjs Repeat html input

I know this will be an easy Question but this is my first angular project
this it what i,m trying to do
<div class="switch-field">
<div class="switch-title">Three fields? Sure.</div>
<input type="radio" id="switch_3_left" name="switch_3" value="yes" checked />
<label for="switch_3_left">One</label>
<input type="radio" id="switch_3_center" name="switch_3" value="maybe" />
<label for="switch_3_center">Two</label>
<input type="radio" id="switch_3_right" name="switch_3" value="no" />
<label for="switch_3_right">Three</label>
</div>
</div>
Fiddle Link
this is my Datasource
this is my Code
<div class='row' ng-show="mk.selectedTypeAttributesID.length != 0">
<div class='col-xs-3 col-sm-3 col-md-3 col-lg-3' ng-repeat="att in mk.selectedTypeAttributesID">
<div class="switch-field">
<div class="switch-title">{{att.name}}</div>
<div ng-repeat="val in att.Values" >
<input class="bttn-input" type="radio" id="switch_{{val.val}}" name="switch_{{att.id}}" value="{{val.val}}" />
<label class="bttn-input" for="switch_3_{{val.val}}">{{val.val}}</label>
</div>
</div>
</div>
</div>
</div>
this is the html result
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 ng-scope" ng-repeat="att in selectedTypeAttributesID">
<div class="switch-field">
<div class="switch-title ng-binding">مقاس</div>
<!-- ngRepeat: val in att.Values -->
<div ng-repeat="val in att.Values" class="ng-scope">
<input class="bttn-input" type="radio" id="switch_43" name="switch_7" value="43">
<label class="bttn-input ng-binding" for="switch_3_43">43</label>
</div>
<!-- end ngRepeat: val in att.Values -->
<div ng-repeat="val in att.Values" class="ng-scope">
<input class="bttn-input" type="radio" id="switch_41" name="switch_7" value="41">
<label class="bttn-input ng-binding" for="switch_3_41">41</label>
</div>
<!-- end ngRepeat: val in att.Values -->
</div>
</div>
</div>
what i want is
1-that the inputs will be under the div "switch-field"
2- why every input in a div
thanks all
As mentioned in a comment, ng-repeat-start and ng-repeat-end are used in situations where you want to repeat more than just a single element. Here is a simple example for your situation using this approach. Rather than repeating on the <div>, use ng-repeat-start on the <input> and ng-repeat-end on the <label>. This will cause each set of <input> and <label> elements to be repeated as a single unit inside the <div>.
angular.module('app', [])
.controller('ctrl', ($scope) => {
$scope.att = {
name: 'SomeAtt',
id: 'SomeId',
Values: [{
val: 1
}, {
val: 2
}, {
val: 3
}]
};
});
.switch-field {
font-family: "Lucida Grande", Tahoma, Verdana, sans-serif;
padding: 40px;
overflow: hidden;
}
.switch-title {
margin-bottom: 6px;
}
.switch-field input {
position: absolute !important;
clip: rect(0, 0, 0, 0);
height: 1px;
width: 1px;
border: 0;
overflow: hidden;
}
.switch-field label {
float: left;
}
.switch-field label {
display: inline-block;
width: 60px;
background-color: #e4e4e4;
color: rgba(0, 0, 0, 0.6);
font-size: 14px;
font-weight: normal;
text-align: center;
text-shadow: none;
padding: 6px 14px;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
-webkit-transition: all 0.1s ease-in-out;
-moz-transition: all 0.1s ease-in-out;
-ms-transition: all 0.1s ease-in-out;
-o-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
.switch-field label:hover {
cursor: pointer;
}
.switch-field input:checked+label {
background-color: #A5DC86;
-webkit-box-shadow: none;
box-shadow: none;
}
.switch-field label:first-of-type {
border-radius: 4px 0 0 4px;
}
.switch-field label:last-of-type {
border-radius: 0 4px 4px 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.2/angular.min.js"></script>
<div ng-app="app" ng-controller="ctrl">
<div class='row'>
<div class='col-xs-3 col-sm-3 col-md-3 col-lg-3'>
<div class="switch-field">
<div class="switch-title">{{att.name}}</div>
<div>
<input ng-repeat-start="val in att.Values" class="bttn-input" type="radio" id="switch_{{val.val}}" name="switch_{{att.id}}" value="{{val.val}}" />
<label ng-repeat-end class="bttn-input" for="switch_{{val.val}}">{{val.val}}</label>
</div>
</div>
</div>
</div>
</div>

How to write jssor in angularjs

Jssor http://www.jssor.com/
<div u="slides" style="cursor: move; position: absolute; left: 0px; top: 0px; width: 1440px; height: 560px; overflow: hidden;">
<div>
<img u="image" src="/static/img/photography/004.jpg" />
<img u="thumb" src="/static/img/photography/thumb-004.jpg" />
</div>
<div>
<img u="image" src="/static/img/photography/009.jpg" />
<img u="thumb" src="/static/img/photography/thumb-009.jpg" />
</div>
</div>
angularjs:
<div u="slides" style="cursor: move; position: absolute; left: 0px; top: 0px; width: 1440px; height: 560px; overflow: hidden;">
<div ng-repeat="coverimg in detailpage.meta.cover">
<img u="image" src="{{detailpage.meta.cover[0].content.url}}" />
<img u="thumb" src="{{detailpage.meta.cover[0].content.url}}?imageView/1/w/75/h/50" />
</div>
</div>
Then the error is
TypeError: Cannot read property '$Highlight' of undefined
Uncaught TypeError: Cannot read property '$TryActivate' of undefined
All you need to check are,
Ensure file(s) for jssor slider are included in your page.
Ensure all image urls are resolved correctly before you call 'jssor_slider1 = new $JssorSlider$(...'

Text on image hover in responsive grid

I've made this responsive image grid.
http://jsfiddle.net/ZhA6a/
<section class="project_main_container">
<ul>
<li>
<div class="project_container">
<div class="project_media">
<img class="project_image" src="http://payload112.cargocollective.com/1/3/97886/4550499/2_800.jpg"></img>
</div>
</div>
</li>
<li>
<div class="project_container">
<div class="project_media">
<img class="project_image" src="http://payload112.cargocollective.com/1/3/97886/4550499/3_800.jpg"></img>
</div>
</div>
</li>
<li>
<div class="project_container">
<div class="project_media">
<img class="project_image" src="http://payload112.cargocollective.com/1/3/97886/4550499/2_800.jpg"></img>
</div>
</div>
</li>
<li>
<div class="project_container">
<div class="project_media">
<img class="project_image" src="http://payload112.cargocollective.com/1/3/97886/4550499/3_800.jpg"></img>
</div>
</div>
</li>
<li>
<div class="project_container">
<div class="project_media">
<img class="project_image" src="http://payload112.cargocollective.com/1/3/97886/4550499/2_800.jpg"></img>
</div>
</div>
</li>
<li>
<div class="project_container">
<div class="project_media">
<img class="project_image" src="http://payload112.cargocollective.com/1/3/97886/4550499/3_800.jpg"></img>
</div>
</div>
</li>
</ul>
</section>
ol, ul {
list-style: none;
line-height: 0;
}
.project_main_container {
width: 100%;
}
.project_container {
float: left;
width: 33.3333333333333333333333333333333333333333333333333%;
background-size:cover;
overflow:hidden;
}
.project_image {
width: 100%;
}
#media only screen and (max-width : 1000px) {
/*row of two boxes*/
.project_container{
width: 50%;
}
}
Each picture represents a design case I've done. I want each image to darken and a text title to show in the middle of the image on hover.
I know that the effect I'm describing is existing but I can't get it working with the responsive grid.
I hope someone will help me - Thanks!
You can do this using :hover with some CSS3 filters. The idea is to add your title as an absolutely positioned element within your grid blocks, and hide it by default. On hover the title will have a display:block applied to it so it appears. And the image will have a filter:brightness applied to darken it a bit.
HTML
<li>
<div class="project_container">
<div class="project_media">
<img class="project_image" src="http://payload112.cargocollective.com/1/3/97886/4550499/3_800.jpg"></img>
<h1>Project Title</h1>
</div>
</div>
</li>
CSS
.project_media h1 {
text-align:center;
position:absolute;
top:50%;
width:100%;
transform:translate(0%,-50%);
-webkit-transform:translate(0%,-50%);
color:#FFFFFF;
font-family:Arial;
text-transform:uppercase;
display:none;
}
.project_container:hover img {
filter: brightness(0.3);
-webkit-filter:brightness(0.3);
-moz-filter:brightness(0.3);
}
.project_container:hover h1 {
display:block;
}
And the working demo.
Something like this http://jsfiddle.net/ZhA6a/1/
No need for js. You can adjust the text position or colour as you like, this is just an example so you get the idea
<section class="project_main_container">
<ul>
<li>
<div class="project_container">
<div class="project_media">
<img class="project_image" src="http://payload112.cargocollective.com/1/3/97886/4550499/2_800.jpg"></img>
<p>text</p>
<div class="dark"></div>
</div>
</div>
</li>
</ul>
</section>
CSS
p {
display: none;
position: absolute;
top: 0;
left: 0;
}
.project_media {
position: relative;
}
.project_media .dark {
display: none;
background: black;
opacity: 0.3;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
}
.project_media:hover .dark {
display: block;
}
.project_media:hover p {
display: block;
}
.project_media:hover img {
opacity: 0.8;
}

Resources