English 中文(简体)
Ken Burns effect withnivo slider
原标题:Ken Burns effect with nivo slider

是否有任何人安装了nivo slider到每一图像(aka Ken Burns effect? 我 trying想执行,这 kind笑!

最佳回答

Actually, I got my implementation working!

我的职能范围很广。

function ken_burns_loop(el) {
  $(el)
    .animate({
       background-position-x :  40% ,
       background-position-y :  60% 
    }, 8000,  linear )
    .animate({
       background-position-x :  30% ,
       background-position-y :  40% 
    }, 8000,  linear )
    .animate({
       background-position-x :  70% ,
       background-position-y :  70% 
    }, 8000,  linear , function() { ken_burns_loop(el); });
}

而I m 开始将尼沃的屈从于此:

$( #welcome-slider ).nivoSlider({
  effect:  fade ,
  slices: 1,
  directionNav: false,
  afterChange: function() {
    $( #welcome-slider, .nivo-slice ).stop(true);
    ken_burns_loop( #welcome-slider, .nivo-slice );
  }
});
ken_burns_loop( #welcome-slider, .nivo-slice );

我仍在解决一些安置问题。

问题回答

Source &rel=“nofollow”>Demo

Add this to your JS:

if(currentEffect ===  kenburns ){
  createZoom(slider, settings, vars);
  zoom = $( .nivo-zoom:last , slider);
  var delta = (8 + Math.random() * 2) / 100;
  var neww = zoom.width() * (1 + delta);
  var newh = zoom.height() * (1 + delta);
  var x = delta * zoom.width(); //Math.random()*(neww-zoom.width());
  var y = delta * zoom.height(); //Math.random()*(newh-zoom.height());
  var zoomdir = Math.round(Math.random() * 4);
  zoom.animate({ opacity: 1.0 }, {easing: linear ,duration:settings.pauseTime*2/3});
  if(zoomdir == 1) {
    zoom.find( img ).animate({ height:newh+ px ,width:neww+ px ,left:  - +x+ px ,top:  - +y+ px },{easing: linear ,duration:settings.pauseTime*4/3, complete: function(){ slider.trigger( nivo:animFinished ); }});
  } else if(zoomdir == 2) {
    zoom.find( img ).animate({ height:newh+ px ,width:neww+ px ,right:  - +x+ px ,top:  - +y+ px }, {easing: linear ,duration:settings.pauseTime*4/3, complete: function(){ slider.trigger( nivo:animFinished ); }});
  } else if(zoomdir == 3) {
    zoom.find( img ).animate({ height:newh+ px ,width:neww+ px ,right:  - +x+ px ,bottom:  - +y+ px }, {easing: linear ,duration:settings.pauseTime*4/3, complete: function(){ slider.trigger( nivo:animFinished ); }});
  } else {
    zoom.find( img ).animate({ height:newh+ px ,width:neww+ px ,left:  - +x+ px ,bottom:  - +y+ px }, {easing: linear ,duration:settings.pauseTime*4/3, complete: function(){ slider.trigger( nivo:animFinished ); }});
  }
  if($( .nivo-zoom , slider).length > 2) $( .nivo-zoom:first , slider).remove();
}




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签