Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- if (!Array.prototype.indexOf) {
- Array.prototype.indexOf = function (obj, fromIndex) {
- if (fromIndex == null) {
- fromIndex = 0;
- } else if (fromIndex < 0) {
- fromIndex = Math.max(0, this.length + fromIndex);
- }
- for (var i = fromIndex, j = this.length; i < j; i++) {
- if (this[i] === obj)
- return i;
- }
- return -1;
- };
- }
- });
- (function( $ ) {
- $.fn.smartResize = function(options) {
- var element = this;
- element.bgWRatio = (element.width() / element.height());
- element.bgHRatio = (element.height() / element.width());
- //var bgWRatio = ((this).width() / (this).height());
- //var bgHRatio = ((this).height() / (this).width());
- function getDocSize(){
- var docAttr = { height: $(window).height(), width: $(window).width() }
- return docAttr;
- }
- function _resizeBG(){
- var obj = getDocSize();
- /*For debugging purposes*/
- obj.wratio = (obj.width / obj.height);
- //obj.hratio = (obj.height / obj.width);
- //console.log('width '+obj.wratio+','+bgWRatio);
- //console.log('height '+obj.hratio+','+bgHRatio);
- var xtraX = ((element.width() - $(window).width()));
- var xtraY = ((element.height() - $(window).height()));
- if (obj.wratio < element.bgWRatio) {
- element.attr('height', obj.height);
- element.attr('width', ((obj.height / element.bgHRatio)));
- } else {
- element.attr('width', obj.width);
- element.attr('height', ((obj.width / element.bgWRatio)));
- }
- }
- _resizeBG();
- $(window).resize(_resizeBG);
- }
- $.fn.imageAdvance = function() {
- var imgArray = []
- $('#PRELOADAN-GAEMS img').each(function(){ imgArray.push($(this).attr('src')); });
- var counter = 0;
- this.click(function() {
- var indicii = (imgArray.indexOf($('#alycia').attr('src'))+1)
- if (indicii > (imgArray.length - 1) ) {
- indicii = 0
- }
- $('#alycia').fadeOut(function(){
- $(this).attr('src', imgArray[indicii]);
- $(this).fadeIn();
- })
- })
- }
- }) ( jQuery );
Add Comment
Please, Sign In to add comment