如何滑动文本和图像从左到右滑动效果 [英] How to slide text and images from left to right with sliding effect

查看:354
本文介绍了如何滑动文本和图像从左到右滑动效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个网页,其中我需要滑动文本和图像,使得图像从左滑动,然后通过使用jquery / javascript点击按钮,从右边滑动文本。

I am creating a web page where I need to slide the text and image in such a way that image slides from left and then the text slides from right on clicking a button by using jquery/javascript.

请检查此滑块我希望我的文字和图片幻灯片这样

Please check this slider I want my texts and image to slide like this

请用必要的js / JQuery建议我

Please suggest me with necessary js/JQuery

推荐答案

a href =http://api.jquery.com/animate/ =nofollow> Jquery API 和演示

Example on Jquery API and demo

有关 daneden.me

he text and image in such a way that image slides from left and then the text slides from right on clicking a button by using jquery/javascript

这是你放在div里面,这是一个解决方案:

This you put inside the div and this is a solution:

<!DOCTYPE html>
<html>
<head>
<style>
div {
position: relative;
background-color: #abc;
width: 40px;
height: 40px;
float: left;
margin: 5px;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<p><button id="go">Run »</button></p>
<div class="block"></div> <div class="block"></div>
<div class="block"></div> <div class="block"></div>
<div class="block"></div> <div class="block"></div>
<script>
$( "#go" ).click(function(){
$( ".block:first" ).animate({
left: 100
}, {
duration: 1000,
step: function( now, fx ){
$( ".block:gt(0)" ).css( "left", now );
}
});
});
</script>
</body>
</html>

这篇关于如何滑动文本和图像从左到右滑动效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆