Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2014
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Refreshing content of the zoomed div using anythingZoomer and changing div content

    Hello all,

    I am having an issue using the simple zoom plugin anythingZoomer (http://css-tricks.com/anythingzoomer-jquery-plugin/) accompanied with a function to switch the text of a DIV with that from an external file.

    My switching function looks like:
    Code:
    function switchText (value) {
    var newText = "poems/example_text"+value+".html";
    $('#textcontainer').load(newText);
    document.getElementById("text_ID").value=value;
    }
    So I have several links set up with switchText(1), switchText(2) etc, to load text into this div from an external file.

    However I am having some difficulty setting this up with the aforementioned anythingZoomer plugin, the activation code of which is as follows:

    Code:
    function activateZoom(){ 
    $("#zoom").anythingZoomer({
    	clone: true,
    	});
    }
    So I currently have both these scripts at the top of my page, and for the sake of figuring out what's going on easier I have my links for the moment set up as switchText(1);activateZoom().

    However some weird stuff is going on which I can't figure out. Bizarrely (at least, it seems pretty bizarre to me) the zoom window is like a click behind the main switching div. If I double click on the links, everything works fine, but if I click on Link 1, the text switches properly (although the positioning is wrong, never mind that for now), but zoom is not activated. If I click again, zoom activates.

    However if I then click on Link 2, the text switches, but the zoom window stays as Text 1.

    Any help would be very much appreciated.

  • #2
    New to the CF scene
    Join Date
    May 2014
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Just a quick update, I seem to have got it mostly functional by removing the activateZoom() function from my links and adding it in <script></script> tags to the bottom of my external html files, however the console in firefox is showing a "too much recursion" error, and it looks to me like the positioning is just slightly off for some reason, so if there is a more elegant way to do what I want to do I would appreciate hearing it. I would also prefer not to have any code in my external html files if at all possible.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •