jquery combine met noConflict

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Daniyal hussain

daniyal hussain

24/02/2013 17:56:36
Quote Anchor link
Hallo,

Ik weet niet precies hoe ik de functie $.noConflict moet gebruiken bij deze code
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<script type="text/javascript" src="http//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
<script>
jQuery (function (e) {
var    $img = $(".imgg",this);
var    $text = $("#gamingcontainer",this);
$img.hide();    

$text.mouseover(function (e){
     $(".imgg",this).show();
     var newi = $("#gamingcontainer img").data('src');
          $("#gamingcontainer img").attr('src', newi);
$("#gamingcontainer", document).mousemove(function(e) {
     $(".imgg",this).offset({
        left: e.pageX,
        top: e.pageY + 20
    });
});

}).mouseleave(function() {
   $(".imgg",this).hide();
}); });

</script>


Graag heb ik jullie hulp nodig.
 
PHP hulp

PHP hulp

26/04/2024 02:39:50
 
Wouter J

Wouter J

24/02/2013 17:59:09
Quote Anchor link
Allereerst zou ik geen 2 jQuery versies gaan gebruiken.
 
Daniyal hussain

daniyal hussain

24/02/2013 18:03:37
Quote Anchor link
als ik het vragen mag waarom niet?
 
Wouter J

Wouter J

24/02/2013 18:24:52
Quote Anchor link
Omdat het allereerst totaal zinloos is. Iets dat werkt in jQuery 1.0 moet ook nog werken in jQuery 1.9. Pas in jQuery 2 (wat nog lang niet uit is) wordt 'backwards compatability' gebroken.

Ten tweede is een jQuery bestand niet niks, ong. 14 Kb (gezipped en minified). 2x inladen is dus 28kb. Ik hoop dat je zelf ook wel inziet dat het veel en veel te veel is.
 
Daniyal hussain

daniyal hussain

24/02/2013 18:27:46
Quote Anchor link
maar als ik jqeury 1.3.2 niet erin doe dan werkt mijn slider niet die ik op mij website heb en werkt ook de code hierboven niet.
 
Wouter J

Wouter J

24/02/2013 18:29:41
Quote Anchor link
Hmm, kun je misschien een online voorbeeldje geven? Ik zie hier namelijk niks in wat verkeerd zou kunnen zijn.
 
Daniyal hussain

daniyal hussain

24/02/2013 18:33:18
Quote Anchor link
ik doe de slider erbij
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
(function($){
    $.fn.extend({
        infiniteCarousel: function(options)
        {
            var defaults =
            {
                transitionSpeed : 1500,
                displayTime : 3000,
                textholderHeight : .25,
                displayProgressBar : 1
            };
        var options = $.extend(defaults, options);
    
            return this.each(function() {
                var randID = Math.round(Math.random()*100000000);
                var o=options;
                var obj = $(this);

                var numImages = $('img', obj).length; // Number of images
                var imgHeight = $($("#topgames"), obj).height();
                var imgWidth = $('div:topgames', obj).width();
                var autopilot = 1;
            
                $('p', obj).hide(); // Hide any text paragraphs in the carousel
                $(obj).width(imgWidth).height(imgHeight);
            
                // Build progress bar
                if(o.displayProgressBar)
                {
                    $(obj).append('<div id="progress'+randID+'" style="position:absolute;bottom:0;background:#0066FF;left:'+$(obj).css('paddingLeft')+'"></div>');
                    $('#progress'+randID).width(imgWidth).height(5).css('opacity','.5');
                }
            
                // Move last image and stick it on the front
                $(obj).css({'overflow':'hidden','position':'relative'});
                $('li:last', obj).prependTo($('ul', obj));
                $('ul', obj).css('left',-imgWidth+'px');
            
                // Build textholder div thats as wide as the carousel and 20%-25% of the height
                $(obj).append('<div id="textholder'+randID+'" class="textholder" style="position:absolute;bottom:0px;margin-bottom:'+-imgHeight*o.textholderHeight+'px;left:'+$(obj).css('paddingLeft')+'"></div>');
                var correctTHWidth = parseInt($('#textholder'+randID).css('paddingTop'));
                var correctTHHeight = parseInt($('#textholder'+randID).css('paddingRight'));
                $('#textholder'+randID).width(imgWidth-(correctTHWidth * 2)).height((imgHeight*o.textholderHeight)-(correctTHHeight * 2)).css({'backgroundColor':'#FFF','opacity':'0.5'});
                showtext($('li:eq(1) p', obj).html());
            
                
        
            
                function showtext(t)
                {
                    // the text will always be the text of the second list item (if it exists)
                    if(t != null)
                    {
                        $('#textholder'+randID).html(t).animate({marginBottom:'0px'},500); // Raise textholder
                        showminmax();
                    }
                }
                function showminmax()
                {
                        if(!autopilot)
                        {
                            html = '<img style="position:absolute;top:2px;right:18px;display:none;cursor:pointer" src="/js/infiniteCarousel/images/down.png" title="Minimize" alt="minimize" id="min" /><img style="position:absolute;top:2px;right:18px;display:none;cursor:pointer" src="/js/infiniteCarousel/images/up.png" title="Maximize" alt="maximize" id="max" />';
                            html += '<img style="position:absolute;top:2px;right:6px;display:none;cursor:pointer" src="/js/infiniteCarousel/images/close.png" title="Close" alt="close" id="close" />';
                            $('#textholder'+randID).append(html);
                            $('#min').fadeIn(250).click(function(){$('#textholder'+randID).animate({marginBottom:(-imgHeight*o.textholderHeight)-(correctTHHeight * 2)+24+'px'},500,function(){$("#min,#max").toggle();});});
                            $('#max').click(function(){$('#textholder'+randID).animate({marginBottom:'0px'},500,function(){$("#min,#max").toggle();});});
                            $('#close').fadeIn(250).click(function(){$('#textholder'+randID).animate({marginBottom:(-imgHeight*o.textholderHeight)-(correctTHHeight * 2)+'px'},500);});
                        }
                }
                function anim(direction)
                {
                    // Fade left/right arrows out when transitioning
                    $('#btn_rt'+randID).fadeOut(500);
                    $('#btn_lt'+randID).fadeOut(500);
                    
                    // animate textholder out of frame
                    $('#textholder'+randID).animate({marginBottom:(-imgHeight*o.textholderHeight)-(correctTHHeight * 2)+'px'},500);                    

                    //?? Fade out play/pause?
                    $('#pause_btn'+randID).fadeOut(250);
                    $('#play_btn'+randID).fadeOut(250);
            
                    if(direction == "next")
                    {
                        // Copy leftmost (first) li and insert it after the last li
                        $('li:first', obj).clone().insertAfter($('li:last', obj));    
                        // Update width and left position of ul and animate ul to the left
                        $('ul', obj)
                            .width(imgWidth*(numImages+1))
                            .animate({left:-imgWidth*2},o.transitionSpeed,function(){
                                $('li:first', obj).remove();
                                $('ul', obj).css('left',-imgWidth+'px').width(imgWidth*numImages);
                                $('#btn_rt'+randID).fadeIn(500);
                                $('#btn_lt'+randID).fadeIn(500);
                                if(autopilot) $('#pause_btn'+randID).fadeIn(250);
                                showtext($('li:eq(1) p', obj).html());
                                if(autopilot)
                                {
                                    $('#progress'+randID).width(imgWidth).height(5);
                                    $('#progress'+randID).animate({'width':0},o.displayTime,function(){
                                        $('#pause_btn'+randID).fadeOut(50);
                                        setTimeout(function(){$('#pause_btn'+randID).fadeIn(250)},o.transitionSpeed)
                                    });
                                }
                            });
                    }
                    if(direction == "prev")
                    {
                        // Copy rightmost (last) li and insert it after the first li
                        $('li:last', obj).clone().insertBefore($('li:first', obj));
                        // Update width and left position of ul and animate ul to the right
                        $('ul', obj)
                            .width(imgWidth*(numImages+1))
                            .css('left',-imgWidth*2+'px')
                            .animate({left:-imgWidth},o.transitionSpeed,function(){
                                $('li:last', obj).remove();
                                $('ul', obj).width(imgWidth*numImages);
                                $('#btn_rt'+randID).fadeIn(500);
                                $('#btn_lt'+randID).fadeIn(500);
                                if(autopilot) $('#pause_btn'+randID).fadeIn(250);
                                showtext($('li:eq(1) p', obj).html());
                            });
                    }
                }
                var clearInt = setInterval(function(){anim('next');},o.displayTime+o.transitionSpeed);
                $('#progress'+randID).animate({'width':0},o.displayTime+o.transitionSpeed,function(){
                    $('#pause_btn'+randID).fadeOut(100);
                    setTimeout(function(){$('#pause_btn'+randID).fadeIn(250)},o.transitionSpeed)
                });
          });
        }
    });
})(jQuery);
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.