[英]Jquery Sliders not working with angular
I have my html like this: 我有这样的html:
<div class="tp-banner">
<ul>
<li data-transition="random" data-slotamount="7" data-masterspeed="1500">
<!-- MAIN IMAGE -->
<img src="assets/img/content/02-home-slide-item-3-1600x700.jpg" alt="slidebg1" data-bgfit="cover" data-bgposition="left top" data-bgrepeat="no-repeat">
<!-- LAYERS -->
<!-- LAYER NR. 1 -->
<div class="tp-caption sft skewtoleft tp-resizeme start white"
data-y="210"
data-x="center"
data-hoffset="0"
data-start="300"
data-customin="x:0;y:0;z:0;rotationX:0;rotationY:0;rotationZ:0;scaleX:0;scaleY:0;skewX:0;skewY:0;opacity:0;transformPerspective:600;transformOrigin:50% 50%;"
data-speed="500"
data-easing="Power3.easeInOut"
data-endspeed="300"
style="z-index: 2">
<h2 class="slide-title">We Help You Learn What You Love</h2>
</div>
<!-- LAYER NR. 2 -->
<div class="tp-caption black randomrotate skewtoleft tp-resizeme start"
data-x="center"
data-hoffset="0"
data-y="240"
data-speed="500"
data-start="1300"
data-easing="Power3.easeInOut"
data-splitin="none"
data-splitout="none"
data-elementdelay="0.1"
data-endelementdelay="0.1"
data-endspeed="500" style="z-index: 99; white-space: pre-line;">
<p class="slide-description">Lorem Ipsum is simply dummy of the printing and typesetting 's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>
</li><!-- end 1st slide -->
<li data-transition="random" data-slotamount="7" data-masterspeed="1000">
<!-- MAIN IMAGE -->
<img src="assets/img/content/02-home-slide-item-2-1600x700.jpg" alt="slidebg1" data-bgfit="cover" data-bgposition="left top" data-bgrepeat="no-repeat">
<!-- LAYERS -->
<!-- LAYER NR. 1 -->
<div class="tp-caption sft skewtoleft tp-resizeme start white"
data-y="210"
data-x="center"
data-hoffset="0"
data-start="300"
data-customin="x:0;y:0;z:0;rotationX:0;rotationY:0;rotationZ:0;scaleX:0;scaleY:0;skewX:0;skewY:0;opacity:0;transformPerspective:600;transformOrigin:50% 50%;"
data-speed="500"
data-easing="Power3.easeInOut"
data-endspeed="300"
style="z-index: 2">
<h2 class="slide-title">Join RootScope Education now & get our free courses!</h2>
</div>
<!-- LAYER NR. 2 -->
<div class="tp-caption black randomrotate skewtoleft tp-resizeme start"
data-x="center"
data-hoffset="0"
data-y="240"
data-speed="500"
data-start="1300"
data-easing="Power3.easeInOut"
data-splitin="none"
data-splitout="none"
data-elementdelay="0.1"
data-endelementdelay="0.1"
data-endspeed="500" style="z-index: 99; white-space: pre-line;">
<p class="slide-description">Lorem Ipsum is simply dummy of the printing and typesetting 's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>
</li><!-- end 2nd slide -->
</ul><!-- end ul elements -->
</div><!-- end tp-banner -->
I am using the following script to load the sliding animation: 我正在使用以下脚本加载滑动动画:
/***************** Slider Revolution ******************/
$('.tp-banner').revolution({
delay:9000,
startheight:616,
navigationVAlign: "center",
soloArrowLeftHOffset: 100,
soloArrowLeftVOffset: 10,
soloArrowRightHOffset: 100,
soloArrowRightVOffset: 10,
hideTimerBar: "on",
hideArrowsOnMobile:"off",
hideThumbs:0
}); // Main Slider
$('.fullscreen').revolution({
delay:9000,
startheight:616,
navigationVAlign: "center",
hideTimerBar: "on",
fullScreen: "on",
hideThumbs:0
}); // Fullscreen Slider
I am using this feature from: https://revolution.themepunch.com/jquery/ 我正在从以下位置使用此功能: https : //revolution.themepunch.com/jquery/
The problem is it was working fine with normal html/css/jquery but when I converted my app to angular then the animation isn't showing up and also the text <h2 class="slide-title">We Help You Learn What You Love</h2>
is not visible at all. 问题是它在正常的html / css / jquery上运行正常,但是当我将应用程序转换为angular时,则动画没有显示,并且文本<h2 class="slide-title">We Help You Learn What You Love</h2>
一点都不可见。 The image is just blank on the landing page. 该图像在目标页面上只是空白。 Why is this happening? 为什么会这样呢? I don't see any console errors also. 我也没有看到任何控制台错误。
Here's the link: http://rootscopeit.in/ 这是链接: http : //rootscopeit.in/
Generally, when I need angular to work with another library, I wrap the commands of the secondary library (JQuery) inside of an AngularJS service. 通常,当我需要angular与另一个库一起工作时,我会将辅助库(JQuery)的命令包装在AngularJS服务中。 Then, add the service to the controller and call the function from the controller. 然后,将服务添加到控制器并从控制器调用该函数。
var app = angular.module("myApp");
(function(){
'use strict';
app.service('mySvc', mySvc);
mySvc.$inject = [];
function mySvc(){
var svc = this;
svc.runJquery = function(){
//Jquery goes here
};
return {runJquery: svc.runJquery}
}
app.controller('myCtrl', myCtrl);
myCtrl.$inject = ["mySvc"];
function myCtrl(mySvc){
mySvc.runJquery();
}
})();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.