jquery如何实现点击图标实现滚动和自动播放效果
上一页下一页
jquery代码
$(function(){
var page = 1;
var $pre = $(‘.brands span.pre’)
var $next = $(‘.brands span.next’);
var $showMoney = $(“.showMoney”);
var $auTofun;
//@Mr.Think***调用自动滚动
autoSlide();
//@Mr.Think***向前滚动
$next.click(function(){
var $parent = $(This).parents(“div.all”);
var $p_show = $parent.find(“div.showMoney”);
var $content = $parent.find(“div.brands”);
var p_width = $content.width();
var len = $p_show.find(“li”).length;
var page_count = Math.ceil(len / i);
if(!$p_show.is(“:animated”)){
if(page == page_count){
$p_show.animate({LEFT:”0px”},”slow”);
$p_show.animate({left:’-=’+p_width},”slow”);

//@Mr.Think***停止滚动
clearFun($showMoney);
clearFun($pre);
clearFun($next);
clearFun($num);
//@Mr.Think***事件划入时停止自动滚动
function clearFun(elem){
elem.hover(function(){
clearAuto();
}, function(){
autoSlide();
function autoSlide(){
$next.trigger(‘click’);
$autoFun = SetTimeout(autoSlide, 1000);//此处不可使用setInterval,setInterval是重复执行传入函数,这会引起第二次划入时停止失效
//@Mr.Think***清除自动滚动
function clearAuto(){
clearTimeout($autoFun);
$pre.click(function(){
var $parent = $(this).parents(“div.all”);
var $p_show = $parent.find(“div.picBd”);
var $content = $parent.find(“div.brands”);
var p_width = $content.width();
var len = $p_show.find(“li”).length;
var page_count = Math.ceil(len / i);
if( !$p_show.is(“:animated”) ){
if( page == 1 ){
$p_show.animate({ left : ‘-=’+p_width*(page_count-1) }, “slow”);
page = page_count;
$p_show.animate({ left : ‘+=’+p_width }, “slow”);
jquery能否判断某个插件是否加载
jQuery的对应fn对象里面有相应的jQuery函数属性比如:$(#test)();我们想判断photoSwipe是否已经引入,可以用:typeof();如果等于function则说明已经载入了,如果不是就没有引入
图片手动自动左右滚动 js
是类似图片轮播的效果吗?能给个类似效果的网站最好 网上有不少jquery插件,自己写的话用jquery也不复杂,贴代码就多了,你可以去网上找找
jquery 动态添加tab 效果
$(#tab)(, {tabs: input});试试把这上面的 tabs 功能定义为一个 function例如 function tabs_run() {....}然後在 click function 里面捕捉 event 完结时侯再次呼叫这个 tabs_run()例如$(#add)(click, function() {_run();}不过我疑惑了,你的 tabContent 没有设置 rel 或者 id… Tabs 是怎样侦测 index 的呢?点击哪个
发表评论