jquery下一个和上一个弹出窗口不工作ie [英] jquery next and previous for popup not working in ie

查看:106
本文介绍了jquery下一个和上一个弹出窗口不工作ie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,



我在弹出窗口中使用jquery作为next和previous。该弹出窗口包含一些数据。下一个和上一个完美地工作在chrome和firefox但是它没有工作。我不知道原因请查看我的代码并给我任何解决方案。



  / *  模态框**** /  

$(' .modal-box )隐藏();
var meal = $(' 。膳食);
var currIndex = 0 ;
var nextIndex = 0 ;
var prevIndex = 0 ;
var popClass = null ;

$(' 。bind')。click( function (event){
var y = window .pageYOffset;
event.preventDefault();
$(' .modal-box' )。hide();
var meal = $(' 。meal');
currIndex = meal.index( this );
nextIndex = currIndex + 1 ;
prevIndex = currIndex - 1 ;
if (currIndex> = meal.length - 1 ){
nextIndex = 0 ;
}
else if (currIndex< = 0 ){
prevIndex = $(餐).length - 1 ;
}
$(' .modal-box' this )。modal({
overlayClose: true
});
popClass =(' .simplemodal-container' + $( this )。attr(' id'));
$(popClass).css( display block);
$(' .modal-box')。css( display );
$(' html,body')。animate({scrollTop:y});
return false ;
});

$(' .next')。click( function (){
var y = window .pageYOffset;
var mealLi = meal.eq(nextIndex);
$ .modal.close();
$(< span class =code-string>'
。modal-box',mealLi).modal({
overlayClose: true
});
currIndex = nextIndex;
prevIndex = currIndex - 1 ;
nextIndex = currIndex + 1 ;
if (currIndex> = meal。 length - 1 ){
nextIndex = 0 ;
}
$( this )。val(' ');
$(' html,body')。animate({scrollTop:y});
});

$(' .preit')。click( function (){
var y = window .pageYOffset;
var mealLi = meal.eq(prevIndex);
$ .modal.close();
$(< span class =code-string>'
。modal-box',mealLi).modal({
overlayClose: true
});
currIndex = prevIndex;
nextIndex = currIndex + 1 ;
prevIndex = currIndex - 1 ;
if (currIndex< = 0 ){
prevIndex = $(餐).length - 1 ;;
}
$( this )。val(' ' );
$(' html,body')。animate({scrollTop:y});
});

$(' .simplemodal-close')。click( function (e){
$(' .modal -box' this )。modal({
overlayClose: false
});
$(' #simplemodal-container')。hide( );
$(popClass).css( display none);
e.preventDefault();
$(' .modal-box')。hide();
popClass = null ;
return ;
});
/ * 模态框*** /





谢谢&问候

Sampath

解决方案

' 模态盒')隐藏();
var meal =


' 膳食')。
var currIndex = 0 ;
var nextIndex = 0 ;
var prevIndex = 0 ;
var popClass = null ;


(< span class =code-string>' .bind')。click( function (事件){
var y = window .pageYOffset;
event.preventDefault ();

Hello All,

I use jquery for next and previous in popup. that popup contains some data. next and previous working perfectly on chrome and firefox but in ie its not working. i dont know the reason please review my code and give me any solution.

/*modal boxes****/

        $('.modal-box').hide();
        var meal = $('.meal');
        var currIndex = 0;
        var nextIndex = 0;
        var prevIndex = 0;
        var popClass = null;

        $('.bind').click(function (event) {
            var y = window.pageYOffset;
            event.preventDefault();
            $('.modal-box').hide();
            var meal = $('.meal');
            currIndex = meal.index(this);
            nextIndex = currIndex + 1;
            prevIndex = currIndex - 1;
            if (currIndex >= meal.length - 1) {
                nextIndex = 0;
            }
            else if (currIndex <= 0) {
                prevIndex = $(meal).length - 1;
            }
            $('.modal-box', this).modal({
                overlayClose: true
            });
            popClass = ('.simplemodal-container' + $(this).attr('id'));
            $(popClass).css("display", "block");
            $('.modal-box').css("display", "block");
            $('html, body').animate({ scrollTop: y });
            return false;
        });

       $('.next').click(function () {
            var y = window.pageYOffset;
            var mealLi = meal.eq(nextIndex);
            $.modal.close();
            $('.modal-box', mealLi).modal({
                overlayClose: true
            });
            currIndex = nextIndex;
            prevIndex = currIndex - 1;
            nextIndex = currIndex + 1;
            if (currIndex >= meal.length - 1) {
                nextIndex = 0;
            }
            $(this).val('');
            $('html, body').animate({ scrollTop: y });
        });

        $('.prev').click(function () {
            var y = window.pageYOffset;
            var mealLi = meal.eq(prevIndex);
            $.modal.close();
            $('.modal-box', mealLi).modal({
                overlayClose: true
            });
            currIndex = prevIndex;
            nextIndex = currIndex + 1;
            prevIndex = currIndex - 1;
            if (currIndex <= 0) {
                prevIndex = $(meal).length - 1;;
            }
            $(this).val('');
            $('html, body').animate({ scrollTop: y });
        });

        $('.simplemodal-close').click(function (e) {
            $('.modal-box', this).modal({
                overlayClose: false
            });
            $('#simplemodal-container').hide();
            $(popClass).css("display", "none");
            e.preventDefault();
            $('.modal-box').hide();
            popClass = null;
            return false;
        });
        /*modal boxes***/



Thanks & Regards
Sampath

解决方案

('.modal-box').hide(); var meal =


('.meal'); var currIndex = 0; var nextIndex = 0; var prevIndex = 0; var popClass = null;


('.bind').click(function (event) { var y = window.pageYOffset; event.preventDefault();


这篇关于jquery下一个和上一个弹出窗口不工作ie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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