开发者

jQuery. jParallax. How I can change default values on click?

I have this - $('.parallax').jparallax({mouseResponse:true}, {}, {});

And I need change mouseResponse to false after click on the link -

$('a.goto').click(function(){ 
});

hepl me please (

upd:

I use this plugin to scroll big div`s in small one. And I want to stop this plugin (stop any scroll) after click on the link below.

f. ex.

html:

<div id="content" class="parallax">
<div style="width:3466px; height:1233px;">img src="../7.jpg"/></div>
</div>
<a href="#j" class="stop"> stopScrolling </a>

js:

i try:

$('a.stop').click(function(){
$('.parallax开发者_运维知识库').jparallax({mouseResponse:false}, {}, {}); 
});

$('.parallax').jparallax({mouseResponse:true}, {}, {}); 

and

$('a.stop').click(function(){
jQuery.fn.jparallax.mouseResponse({mouseResponse:false});
});

$('.parallax').jparallax({mouseResponse:true}, {}, {}); 

upd2:

I found this http://flickaway.s3.amazonaws.com/ploreex/ploreex.html - They Lock jparallax on press space. Don`t know how to do it in my project


$("a.goto").click(); I don't know if that is what you want


Maybe you're thinking this :

$('a.goto').click(function(ev){ 
ev.preventDefault();
});


Is this what you're trying to accomplish? http://webdev.stephband.info/parallax_demos_type.html

the source code is pretty straight forward with one tweak I made for better practice jQuery event bubbling

$('a.goto').click(function(e){
    e.preventDefault();
    var ref = $(this).attr("href");
    $('#parallax').trigger("jparallax", [ref]);
});

Assuming a markup like so

<a href="#anchor" class="goto">Anchor</a>


solution:

var varName = false;

find in plugin code - // Mouse Response - and replace with your var

// Mouse Response
    if (settings.mouseResponse) {
        jQuery().mousemove(function(mouse){

            if (varName) return;

change var on click

    $('a').click(function(){

    stopParallax = true;
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜