PDA

View Full Version : Iframe won't stop dragging..unbind hasn't worked..any ideas?



tedteeter
12-15-2015, 04:51 AM
Greetings, Dec 17th, 2015

I have a page which utilizes an include to create and iframe which as well loads a page into the iframe!..the loaded page has a couple of iframes! using the below code I can now reference the parent to move the iframe that often acts erraticaly with the below code! The problem? how to unbind the iframe so the scrollbars, select boxes can be scrolled without moving the entire iframe...any ideas?


function drag_frame(drg){
var frameref=document.getElementById('spellcheck10frame');
var $frame=$(frameref);
//if(document.getElementById('move_bar').style.cursor=='move'){

mouse_over = false;
mouse_position = null;
mouse_position2 = null;

$frame.contents().bind("mousedown", function(e){
mouse_over = true;
mouse_positionx = e.pageX;
mouse_positiony = e.pageY;

});

$frame.contents().bind("mouseup", function(e){
mouse_over = false;
});

$(document).bind("mousemove", function(e) {
// $("#result").html("x:" + e.pageX + ", y:" + e.pageY);
});

$frame.contents().bind("mousemove", function(e) {
if (mouse_over == true){

var x=$frame.offset().left+(e.pageX) - mouse_positionx;
var y=$frame.offset().top+(e.pageY) - mouse_positiony;

//$("#result").html("x:" + (e.pageX) + ", y:" + e.pageY);
////$("#spellcheck10frame").css({"left" : x});
////$("#spellcheck10frame").css({"top" : y});
$(frameref).css({"left" : x});
$(frameref).css({"top" : y});

}
});

//}
//function
}